react-nativereact-native-camera

React Native camera works first time then not working (black screen) in android device


I was using an older version of react-native-camera and it worked fine on iOS. But it did not work on Android. I am creating a function like scanning code combines with taking pictures after isBarcodeRead logic done. Then I tried upgrading this lib up to and met the same problem as yours.


Solution

  • I had this issue with react-navigation router. Camera stops working after I changing page This code solved it for me

    import { withNavigationFocus } from 'react-navigation' 
        render() {
            const { isFocused } = this.props
            return (
               <View>
                 { isFocused && <RNCamera  ... />  }
               </View
             )
        }
        export default withNavigationFocus(Camera) `