Skip to content

fix(mobile): request camera permission on iOS to avoid blank screen#637

Open
Nareshkumawat-star wants to merge 1 commit into
Dev-Card:mainfrom
Nareshkumawat-star:fix/camera-permission-safari-final
Open

fix(mobile): request camera permission on iOS to avoid blank screen#637
Nareshkumawat-star wants to merge 1 commit into
Dev-Card:mainfrom
Nareshkumawat-star:fix/camera-permission-safari-final

Conversation

@Nareshkumawat-star

Copy link
Copy Markdown

Summary

This PR resolves the iOS camera permission handling issue in the mobile QR scanner screen. Previously, when the camera permission status was undetermined (-1), the screen assumed permission was granted and mounted the native Camera component. If the user subsequently denied permission in the iOS system dialog, the scanner area stayed blank without showing any error feedback or prompt to re-enable permissions in settings.

With this change, permission is requested programmatically first. If denied, the UI correctly transitions to a placeholder screen with a button that triggers a settings redirect dialog.


Closes : #610

Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • apps/mobile/src/screens/ScanScreen.tsx:
    • Imported Linking, AppState, AppStateStatus, and NativeModules from react-native.
    • Added a checkInitialCameraPermission function to check status and prompt for authorization programmatically using RNCameraKitModule if status is undetermined (-1).
    • Updated requestCameraPermission to show a user-friendly alert on iOS if permissions are denied, with a redirect link directly to iOS App Settings.
    • Added an AppState listener to automatically re-evaluate camera permission status when the user returns to the app from iOS Settings.
    • Fixed an ESLint warning for an unused err variable in handleSaveQR.

How to Test

  1. Open the mobile app on iOS.
  2. Navigate to the Scan screen.
  3. Deny camera permission when the iOS system dialog prompts.
  4. Verify that the app shows the "Camera Permission Required" placeholder instead of a blank black screen.
  5. Tap "Grant Permission" and click "Settings" to verify that the app redirects you to the iOS settings menu.

Checklist

  • My code follows the project's coding style (npm run lint passes).
  • TypeScript compiles without errors (npm run typecheck --workspaces --if-present).
  • I have added or updated tests for the changes I made.
  • All tests pass locally (npm run test --workspaces --if-present).
  • I have updated documentation where necessary.
  • No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. mobile labels Jun 22, 2026
@github-actions

Copy link
Copy Markdown

Hi @Nareshkumawat-star,

Thanks for opening this pull request.

This PR has been automatically classified based on the files modified.

Applied Labels

  • gssoc:approved
  • mobile

Primary Review Area

  • mobile

Reviewer

@blankirigaya has been identified as the primary reviewer for this pull request.

If you have any questions regarding the affected area or implementation details, feel free to reach out to the assigned reviewer.

Thank you for your contribution!

@github-actions

Copy link
Copy Markdown

CI — All Checks Passed

Backend — SKIP

Check Result
Lint -
Test -
Typecheck -

Mobile — PASS

Check Result
Lint PASS
Test PASS

Web — SKIP

Check Result
Build -

Last updated: Mon, 22 Jun 2026 16:38:14 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: QR code scanner fails silently on iOS Safari when camera permission is denied

1 participant