This repository has been archived by the owner on May 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 516
How to proper deactivate scanning if you are using react-navigation and go to next screen #136
Labels
Comments
I'm using react-navigation's NavigationEvents:
But this is also rerendering on every page-switch. If you find a better solution, let me know. |
If you still have problem with onDidFocus not firing, maybe you have the same: |
mnzaki
added a commit
to jolocom/smartwallet-app
that referenced
this issue
Jul 15, 2019
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.
Hi, set to de/reactivate the scanner by hooking into the focus lifecycle from react-navigation (this is typescript with react native):
References: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What's happening?
I would like to know the most proper way how to deactivate qr scanner if you go to next screen with react navigation
I tried with additional variable {qrScannerEnabled && <QRCode.. />}, that has performance issues - I just want enable/disable scanner, not always rerender the whole scanner.
I tried to set reactivate={qrScannerEnabled}, so to disable it when go to next screen, but it still scans code one more time, then it is disabled (I tried also force update with setState, but no effect)
Currently I am resetting the state with NavigationActions, but that is also not super performant.
Is there any smart solution for this?
Build details?
Android 8.1
The text was updated successfully, but these errors were encountered: