Reputation: 1
Im trying to show the camera feed from the selfie camera inside of a <View>
component, and I've been getting this error constantly. I've tried reinstalling react-native-camera and using expo-camera
, but im all out of ideas.
Code:
import {RNCamera, Camera} from 'react-native-camera'
import { View,Text,Screen,Image } from 'react-native';
import Button from 'apsl-react-native-button';
import React from 'react';
export default function Reunion ({navigation}){
return (
<View style={{
backgroundColor: "#fff",
flex:1,
alignItems: 'center',
justifyContent: 'center'
}}>
<View
style={{
position: 'relative',
left:0,
top:-15,
width:1080,
height:480,
backgroundColor: '#c4c4c4'
}}
>
<RNCamera
style={{ flex: 1, alignItems: 'center' }}
captureAudio={false}
ref={ref => {
this.camera = this.camera.bind(this )
this.camera = ref
}}
/>
</View>
</View>
)
}
Upvotes: 0
Views: 506
Reputation: 6957
This might help
import {RNCamera, Camera} from 'react-native-camera'
import { View,Text,Screen,Image } from 'react-native';
import Button from 'apsl-react-native-button';
import React from 'react';
export default function Reunion ({navigation}){
const cameraRef = React.createRef();
return (
<View style={{
backgroundColor: "#fff",
flex:1,
alignItems: 'center',
justifyContent: 'center'
}}>
<View
style={{
position: 'relative',
left:0,
top:-15,
width:1080,
height:480,
backgroundColor: '#c4c4c4'
}}
>
<RNCamera
style={{ flex: 1, alignItems: 'center' }}
captureAudio={false}
ref={cameraRef}
/>
</View>
</View>
)
}
Upvotes: 1