首先看官方文档github上面react-native-camera的官方文档部署开发环境:
我配置的开发的环境如下:
1.Android Studio 3.0.1
2.react-native 0.57.4
3.react-native-camera 1.4.1
4.模拟器采用Genymotion Google Pixel2- 8.0 -API26
核心代码:
这是官方给出的示例代码,复制上去就可以了,以下我粘贴了一小部分:
<RNCamera
ref={ref => {
this.camera = ref;
}}
style={ {
flex: 1,
}}
type={this.state.type}
flashMode={this.state.flash}
autoFocus={this.state.autoFocus}
zoom={this.state.zoom}
whiteBalance={this.state.whiteBalance}
ratio={this.state.ratio}
faceDetectionLandmarks={RNCamera.Constants.FaceDetection.Landmark