react-native-qrcode-scanner
react-native-qrcode-scanner copied to clipboard
Support notAuthorizedView in Android
When the user does not authorize the camera, there is currently no way in Android to show to the user that they need to give authorization.
What's happening?
In Android, when navigating to the view that renders the QRCodeScanner, the user is asked for permission. If the user denies that permission, for whatever reason, they are given no indication that there should be something there. There is an iOS property called notAuthorizedView that shows the problem in iOS, but currently isn't supported in Android.
How can it be reproduced?
- Fire up Android
- Navigate to a page with QRCodeScanner
- When Permissions for the camera are requested, reject those permissions. Alternatively, go into the Android app permissions and turn off the camera
- Observe that there is no indication that the QRCodeScanner has had a problem
Build details?
Android 8.1.0 react-native-qrcode-scanner: 0.0.22
I'm not sure it's still relevant but you can change the notAuthorizedView prop of the camera:
<QRCodeScanner cameraProps={{ notAuthorizedView: <View><Text>Not authorized</Text></View> }} />
i am having the same problem
It's still not supported :(
I'm not sure it's still relevant but you can change the notAuthorizedView prop of the camera:
<QRCodeScanner cameraProps={{ notAuthorizedView: <View><Text>Not authorized</Text></View> }} />
this could be the correct answer! Thank you :)
I'm not sure it's still relevant but you can change the notAuthorizedView prop of the camera:
<QRCodeScanner cameraProps={{ notAuthorizedView: <View><Text>Not authorized</Text></View> }} />
That worked, thanks you so much! I have to do like (the same prop twice, one to work on android, and the another to work on ios):
<QRCodeScanner
cameraProps={{
notAuthorizedView: (
<View>
<Text>Not authorized</Text>
</View>
),
}}
notAuthorizedView={
<View>
<Text>Not authorized</Text>
</View>
}
/>