-
Notifications
You must be signed in to change notification settings - Fork 516
Black screen after scanning a qr code #161
Comments
I think it is issue from RNcamera itself! |
react-native-camera/react-native-camera#1686 (comment) ` componentDidMount() { render() { this solved my issue. still the appearance of camera is flicker, using animated view in react-native-qrcode-scanner |
initial screen itself is freezing with blank black screen instead of camera interface |
I think your camera component never remount after the first usage. The easiest way to fix is to give the component the unique value every time you rout to the component. then I added some useless actions to the component to double make sure that it really rerendered like this constructor(props) { componentDidMount() { and now it works 10 out of 10 times |
This issue is from RNCamera, and its solution is documented here: The solution is for react-navigation however a similar approach could be implemented with other navigation packages (like react-native-navigation using componentDidAppear and componentDidDisappear. |
infinitered/ignite-andross#277 moaazsidat/react-native-qrcode-scanner#161 moaazsidat/react-native-qrcode-scanner#177 moaazsidat/react-native-qrcode-scanner#136 react-native-camera/react-native-camera#1797 react-native-camera/react-native-camera#1686 react-native-camera/react-native-camera#1686 react-navigation/redux-helpers#87 react-navigation/redux-helpers#60 react-navigation/redux-helpers#53 https://www.youtube.com/watch?v=CnQ8N1KacJc Fixes #1326 The navigation actions were turned into ThunkActions and now directly call react-navigation's navigator.dispatch, which handles state internally Usages of the navigationActions were fixed Also QRcodeScanner was cleaned up a bit and hacked to properly re-enable the camera by re-rendering it (so it gets remounted). Now camera works again if you press back after scanning a QR code.
Thank you @j0nd0n7 for the link... `import { useIsFocused } from '@react-navigation/core'; export const Component = () => { // ... if (hasCameraPermission === false) { |
@moaazsidat @mamodom @mjgallag
What's happening?
after scanning a qr code successfully, I'm redirecting to other screen.
when i come back to qr code scanning screen, cam is blacked out.
How can it be reproduced?
add a qr code scanner screen and other screen in a tab nav bar
Build details?
version: react-native-qrcode-scanner - 1.1.2
android: 7.0
react-native: 57
The text was updated successfully, but these errors were encountered: