Skip to content

Update react-native-permissions to 5.6.3 so iOS location checks stop freezing the app - #106934

Merged
mountiny merged 5 commits into
Expensify:mainfrom
twilight2294:ios-location-check-off-main
Nov 16, 2026
Merged

mountiny merged 5 commits into
Expensify:mainfrom
twilight2294:ios-location-check-off-main

Conversation

@twilight2294

@twilight2294 twilight2294 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

On iOS, react-native-permissions 5.4.0 runs check on the main thread, and the location check reads CLLocationManager authorizationStatus, which waits on iOS location services. When they're slow to answer, the app freezes while the scan screen opens or a scan is submitted. 5.6.3 runs check on a background queue (release note). The jest mock now imports PERMISSIONS from react-native-permissions/mock, since 5.5.0 blocks deep imports.

iPhone 16 Pro simulator, iOS location services paused 5.4.0 5.6.3
opening the scan screen, 3 runs froze 2.4 to 2.8 s no freeze
tapping Create expense on a scanned receipt, 3 runs froze 3.5 s no freeze

Fixed Issues

$ #106951
PROPOSAL: #106951

Tests

  1. On iOS, allow location access for the app
  2. Open the scan screen and verify it opens normally
  3. Pick a receipt from the gallery, create the expense and verify it shows up
  4. In iOS Settings, set the app's location access to Never, open the scan screen again and verify the location prompt shows
  5. On iOS 18 or later, with contact access not decided yet, go to Create expense > Manual > Next
  6. In Import your contacts, tap Continue, then tap Continue in the iOS prompt
  7. Tap Select Contacts, pick a contact, tap Continue, then Allow Selected Contact
  8. Verify the picked contact shows up in the list right away
  • Verify that no errors appear in the JS console

Offline tests

Same as tests, with the device offline.

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
1-Android-Native.mp4
Android: mWeb Chrome
2-Android-mWeb-Chrome.mp4
iOS: Native
3-iOS-Native.mp4
iOS: mWeb Safari
4-iOS-mWeb-Safari.mp4
MacOS: Chrome / Safari
5-MacOS-Chrome.mp4

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@expensify-chore-bot

Copy link
Copy Markdown

@sobitneupane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:17:49.958652Z 6e70611 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@twilight2294

Copy link
Copy Markdown
Contributor Author

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

Asked on slack https://expensify.slack.com/archives/C01GTK53T8Q/p1794798396494929?thread_ts=1794769002.994209&cid=C01GTK53T8Q

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@mountiny
mountiny requested review from mountiny and situchan and removed request for sobitneupane November 16, 2026 03:24

@situchan situchan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the leftover type declaration for the old deep import

declare module 'react-native-permissions/dist/commonjs/permissions' {
import {PERMISSIONS, RESULTS} from 'react-native-permissions';
export {PERMISSIONS, RESULTS};
}

This file declares react-native-permissions/dist/commonjs/permissions, which only existed for the jest mock's deep import.
After this PR nothing imports that path, and since 5.5.0 the package exports field blocks it.
A future import would typecheck but fail at runtime.

There's no in-app repro because this is type-only.

Delete src/types/modules/react-native-permissions.d.ts.

@github-actions

This comment has been minimized.

@situchan

Copy link
Copy Markdown
Contributor

react-native-permissions 5.4.0 to 5.6.3

Version Change Effect on App
5.4.1 Other platforms' PERMISSIONS maps are proxied to avoid edge cases None
5.4.2 Android check returns UNAVAILABLE instead of DENIED for unsupported permissions Minor
5.4.3 iOS 14+ reads authorizationStatus from a CLLocationManager instance Internal
5.4.4 Fixes missing iOS privacy usage descriptions from 5.4.3 Internal
5.5.0 Adds the exports field, so deep imports are blocked Why the jest mock import changes
5.5.1 Fixes the nested PERMISSIONS object in the mock Test only
5.5.2 Fixes a lockHandler crash Good for us
5.5.3 request(CONTACTS) returns limited instead of granted for limited access. check(LOCATION_ALWAYS) reports denied instead of blocked Contacts change needs a test (below). App doesn't use LOCATION_ALWAYS
5.6.0 Adds openContactPicker (iOS 18+) Not used. The Contacts pod now adds a Swift file and ContactsUI
5.6.1 Fixes stale calendar and reminders status Not used
5.6.2 Applies kotlin-android only when it isn't already registered Build only
5.6.3 iOS check and checkLocationAccuracy run on a background queue The fix this PR is for

Worth testing: limited contact access on iOS 18+

In the import contacts modal, onGrant only runs when the result is GRANTED. Limited access now returns LIMITED, so that call is skipped:

if (permissionStatus === RESULTS.GRANTED) {

Contacts likely still load, because this re-check runs when the app becomes active again and treats LIMITED as granted:

return getContactPermission()
.then((newStatus) => {
const isNewStatusGranted = newStatus === RESULTS.GRANTED || newStatus === RESULTS.LIMITED; // Permission is enabled, or just became enabled
if (isNewStatusGranted) {
importAndSaveContacts();

  1. On iOS 18+ with contact access not yet decided, open Create expense > Manual > Next
  2. In the import contacts modal, tap Continue
  3. In the system prompt, choose Limited Access, pick a contact and confirm

Expected: the chosen contact appears in the participant list right away.
Fix if it fails: also accept RESULTS.LIMITED at that line.

@twilight2294

Copy link
Copy Markdown
Contributor Author

Checking

@twilight2294
twilight2294 requested a review from a team as a code owner November 16, 2026 03:53
@expensify-chore-bot
expensify-chore-bot Bot requested review from trjExpensify and removed request for a team November 16, 2026 03:53
@situchan

situchan commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Please also add test case for import contacts

The behavior should be same as production

@situchan

situchan commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.mov
Android: mWeb Chrome
iOS: HybridApp
ios.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari

@twilight2294

Copy link
Copy Markdown
Contributor Author

Delete src/types/modules/react-native-permissions.d.ts.

Done in b1dcf0e

Worth testing: limited contact access on iOS 18+

Tested on iOS 18.6 with limited access, the picked contact shows up right away, same as prod. useContactPermissions checks again when the app comes back and treats LIMITED as granted.

6-iOS-Native-limited-contact-access.mp4

Please also add test case for import contacts

Added to the test steps for QA, and added a unit test for limited access in 74d06cf

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mountiny
mountiny merged commit 79bac93 into Expensify:main Nov 16, 2026
47 of 49 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.40-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this dependency upgrade fixes iOS freezes during receipt scanning without introducing a new workflow or making existing article instructions incorrect.


view run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants