react-native-qrcode-scanner icon indicating copy to clipboard operation
react-native-qrcode-scanner copied to clipboard

Support notAuthorizedView in Android

Open reabbotted opened this issue 6 years ago • 5 comments

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?

  1. Fire up Android
  2. Navigate to a page with QRCodeScanner
  3. When Permissions for the camera are requested, reject those permissions. Alternatively, go into the Android app permissions and turn off the camera
  4. 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

reabbotted avatar Apr 02 '18 18:04 reabbotted

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> }} />

shgitns avatar Jan 08 '19 15:01 shgitns

i am having the same problem

swathyashokan avatar Jan 09 '19 07:01 swathyashokan

It's still not supported :(

TatianaMatumoto avatar Sep 21 '21 13:09 TatianaMatumoto

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 :)

WenLonG12345 avatar Nov 23 '21 07:11 WenLonG12345

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>
                    }
                />

TatianaMatumoto avatar Dec 07 '21 11:12 TatianaMatumoto