I'm developing an app that reads QR Codes using react-native-camera, but camera preview does not appear on screen.
I'm working on react-native 0.57.7
, using react-native-camera 1.10.0
. I have run the following commands:
npm install react-native-camera --save
react-native link react-native-camera
Here is where I'm calling the camera in my code:
import React, {Component} from 'react';
import {View, Image, TouchableOpacity, ScrollView} from 'react-native';
import RNCamera from 'react-native-camera';
class profPresencaScreen extends Component{
<View style={{flex: 1}}>
<RNCamera
ref={ref => {
this.camera = ref;
}}
defaultTouchToFocus
mirrorImage={false}
permissionDialogTitle={'Permission to use camera'}
permissionDialogMessage={'We need your permission to use your camera phone'}
/>
</View>
}
export default profPresencaScreen;
The permission dialog opens and it even shows a loading asset in the first time I open the app, but the camera preview never appears. Is there any way I can show it on my app?
EDIT: I made it work! I set manually the style of the camera:
<RNCamera
ref={ref => {
this.camera = ref;
}}
defaultTouchToFocus
mirrorImage={false}
permissionDialogTitle={'Permission to use camera'}
permissionDialogMessage={'We need your permission to use your camera phone'}
style={{flex: 1}}
/>
Simple as that! Thanks to everyone that tried to help!