-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompt error on iOS when camera access is disallowed #1036
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
2 similar comments
recheck |
recheck |
recheck |
Thanks! I'll test this out locally myself and will merge after 👍 |
@@ -51,6 +52,24 @@ function showDocumentPicker(callback) { | |||
function show(callback) { | |||
RNImagePicker.showImagePicker(imagePickerOptions, (response) => { | |||
if (response.error) { | |||
if (response.error === 'Camera permissions not granted') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional context on the unconventional error check here:
Since we're using the deprecated 2.x.x react-native-image-picker
module at the moment, we're forced to use the textual error
message returned by the library.
The new 3.x.x version has a dedicated error code for permissions, which is a far cleaner solution.
@AndrewGable Are there any plans for us to upgrade react-native-image-picker
, or should this solution be acceptable for now? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think updating to the latest would be great 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for now, thanks! Checking in with @AndrewGable regarding react-native-image-picker
versioning before merging 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itsimon21 Thanks for your patience! Per the discussion in the thread here: #1036 (comment), would you mind upgrading react-native-image-picker
to 3.x.x
and checking the error code for the permissions error rather than the error message? Thanks!
@robertjchen The new 3.x.x version of react-native-image-picker has removed the "showImagePicker" method. According to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itsimon21 Hm, good point 🤔 Not sure why they deprecated that functionality in 3.x.x
That custom button is pretty crucial functionality- the alternative is to re-design the UI to accommodate a separate button for react-native-document-picker
functionality (in addition to react-native-image-picker
). Will merge for now 👍
Details
Fixed Issues
When tapping "Take Photo", the app should request permission to access the camera.
Tests
Prerequisite: Allow Expensify.Cash to access: Camera is disabled in device settings
Screenshots