I have tried to implement Camera
in my react-native
application by using react-native-camera
, However it doesn't seem like working. When i run react-native run-android
blank white screen is appearing with out any errors. Here is my code,
import Camera from 'react-native-camera';
<Camera
style={Styles.preview}
aspect={Camera.constants.Aspect.fill}
ref={cam => { this.camera = cam; }}
/>
const Styles = {
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center',
}
};
Did you set the permission so that the app can use the camera? If you haven't than you can set the permission as below:
Android
To enable video recording feature you have to add the following code to the
AndroidManifest.xml
:ios
Add the following permission in
/ios/yourProject/Info.plist
For full setup and code for camera app on ios follow this tutorial. For more info on permission follow this.