# react-native-camera **Repository Path**: kunyuan-hongke/react-native-camera ## Basic Information - **Project Name**: react-native-camera - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-07 - **Last Updated**: 2025-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README > 模板版本:v0.2.2

@ohmi/react-native-camera

Supported platforms License

> [!TIP] [Gitee 地址](https://e.gitee.com/kunyuan-hongke/projects/723653/repos/kunyuan-hongke/react-native-camera/sources) ## 介绍 本项目基于[react-native-camera](https://github.com/react-native-camera/react-native-camera/tree/v3.30.0)开发。 ## 安装与使用 请到三方库的 Releases 发布地址查看配套的版本信息:[@ohmi/react-native-camera Releases](https://e.gitee.com/kunyuan-hongke/projects/723653/repos/kunyuan-hongke/react-native-camera/releases) 。对于未发布到npm的旧版本,请参考[安装指南](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: #### npm ```bash npm install @ohmi/react-native-camera ``` #### yarn ```bash yarn add @ohmi/react-native-camera ``` 下面的代码展示了这个库的基本使用场景: > [!WARNING] 使用时 import 的库名不变。 ### photo example ```js import React, {useState, useRef} from 'react'; import {StyleSheet, Text, View, Button, Image} from 'react-native'; import {RNCamera} from 'react-native-camera'; export const PhotoDemo = () => { const cameraRef = useRef(null); const [capturedImage, setCapturedImage] = useState(null); const takePicture = async () => { if (cameraRef.current) { try { const options = {quality: 0.5, base64: false}; const data = await cameraRef.current.takePictureAsync(options); setCapturedImage(data.uri); } catch (error) { console.error('拍照出错:', error); } } }; return ( {capturedImage ? ( ) : ( )}