Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React Native Camera not Appearing (iOS)

$
0
0

I am building an app to record video using React Native and RNCamera. I've installed RNCamera with the commands: npm install react-native-camera and pod install; however, when my app runs, the camera (and the button I created to trigger the camera) do not show up. Here is where I declare my RNCamera:

<View style={styles.container}><RNCamera          ref={(ref) => {            this.camera = ref;          }}          style={styles.preview}          type={RNCamera.Constants.Type.front}          flashMode={RNCamera.Constants.FlashMode.on}          // permissionDialogTitle={'Permission to use camera'}          // permissionDialogMessage={          //   "We need your permission to use your phone camera"          // }          androidCameraPermissionOptions={{            title: 'Permission to use camera',            message: 'We need permission to use your camera',            buttonPositive: 'Ok',            buttonNegative: 'Cancel',          }}          androidRecordAudioPermissionOptions={{            title: 'Permission to use audio recording',            message: 'We need your permission to use your audio',            buttonPositive: 'Ok',            buttonNegative: 'Cancel',          }}        /><View          style={{ flex: 0, flexDirection: "row", justifyContent: "center"}}><TouchableOpacity onPress={this.startRecording.bind(this)} style={styles.capture}><Text style={{ fontSize: 14 }}> RECORD </Text></TouchableOpacity></View></View>

My startRecording() function is declared as follows:

  startRecording = async () => {    const options = { orientation: "landscapeRight"};    this.setState({ recording: true });    const { uri, codec = "mp4" } = await this.camera.recordAsync(options);    console.log(uri)  }

Does anyone know how to get RNCamera to show up? I've tried to manually link it, too, but that did not work. Thank you!


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>