Skip to content

[Due for payment 2026-05-20] [Due for payment 2026-05-18] iOS - Camera - App theme does not change while on camera mode #90236

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.69-13
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #87681
Email or phone of affected tester (no customers): josdjnosdjionjsdonjisod@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 15 Pro Max / iOS 26.4.2
App Component: Chat Report View

Action Performed:

  1. Launch Expensify app.
  2. Go to workspace chat.
  3. Tap + > Add attachment > Take photo.
  4. Pull down control center.
  5. Turn on/off dark mode.
  6. Dismiss control center.

Expected Result:

App theme will change while on camera mode.

Actual Result:

App theme does not change while on camera mode.
It only changes after closing camera mode.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7151020_1778518021089.ScreenRecording_05-12-2026_00-43-31_1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @ShridharGoel

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    on May 11, 2026
  2. melvin-bot commented on May 11, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #87681

  3. melvin-bot commented on May 11, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on May 11, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on May 11, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #87681 - "fix: use in-app VisionCamera for chat attachment photos" by @MelvinBot (High confidence)
    Related Issues: #84018 (original bug this PR was fixing)

    Recommendation: REVERT

    PR #87681 introduced a new AttachmentCamera component that wraps the in-app camera in a React Native <Modal>. On iOS, React Native's Modal component renders in a separate native view hierarchy, which is isolated from the parent React context tree. This means that when the system color scheme changes (e.g., toggling dark/light mode via Control Center), the ThemeContext update does not propagate into the modal, so the camera screen retains the stale theme until the modal is closed. Reverting this PR resolves the issue.

    Assigned: @ShridharGoel (approving reviewer), @srikarparsi (approving reviewer) from PR #87681
    Labels: DeployBlockerCash kept (Frontend bug in App repo). No label changes made.

    Detailed Analysis

    Evidence

    Verification

    • The affected file is src/components/AttachmentPicker/AttachmentCamera.tsx, which was created entirely by PR fix: use in-app VisionCamera for chat attachment photos #87681.
    • The AttachmentCamera component uses useTheme() and useThemeStyles() to obtain theme values, which depend on ThemeContext.
    • The component wraps its UI in a React Native <Modal visible={isVisible} ...> component.
    • ThemeProvider (in src/components/ThemeProvider.tsx) provides theme context via ThemeContext.Provider. On iOS, React Native's <Modal> renders in a separate native window, breaking the React context chain — child components inside the modal do not receive context updates from the parent tree when the system theme changes while the modal is open.
    • The receipt scan camera screen (IOURequestStepScan) does not use a <Modal> — it is a proper navigation screen — which is why it does not have this problem.

    Root Cause

    AttachmentCamera renders its content inside a React Native <Modal>. On iOS, this modal creates a new native UIWindow, which hosts a separate React root. The ThemeContext provided by the app-level ThemeProvider is not automatically bridged into this new root. As a result, when the user toggles dark/light mode from the Control Center while the camera modal is open, useColorScheme() fires in the main app tree and updates ThemeContext, but the modal's component subtree does not receive this update. The theme change only takes effect after the modal is closed and re-rendered within the main tree.

  6. MelvinBot commented on May 11, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    AttachmentCamera (AttachmentCamera.tsx:178) uses React Native's raw <Modal> directly (imported from 'react-native'). On iOS, this creates a separate native UIWindow, which becomes the key window. When the user toggles dark/light mode from Control Center while the camera modal is open, the Appearance change event targets this new key window — but useColorScheme() in useThemePreference.ts:9 (consumed by ThemeProvider.tsx) lives in the original RCTRootView window and does not receive the update. The theme change only takes effect after the modal is dismissed.

    By contrast, IOURequestStepScan (index.native.tsx) is a regular navigation screen (no <Modal>), so no separate UIWindow is created and theme propagation works normally.

    What changes do you think we should make in order to solve the problem?

    Replace the raw <Modal> in AttachmentCamera with a full-screen navigation screen approach (similar to IOURequestStepScan), or at minimum switch to the app's BaseModal which already wraps children in ColorSchemeWrapper (line 411).

    Since BaseModal still ultimately uses RN's Modal under the hood (same UIWindow issue), the cleanest fix is to restructure AttachmentCamera as a navigation screen instead of a modal — this completely eliminates the separate UIWindow and ensures theme context propagates correctly.

    What alternative solutions did you explore? (Optional)

    Wrapping Modal children in a new ThemeProvider: This alone wouldn't fix it — ThemeProvider itself depends on useColorScheme(), which is the broken link when a separate UIWindow is the key window.

    Listening to Appearance.addChangeListener inside the Modal: This could work as a workaround by manually subscribing to appearance changes from within the Modal's component tree, but it adds complexity and diverges from the established pattern.

    Supporting evidence
    • AttachmentCamera imports raw Modal from 'react-native' at line 2 and renders it at line 178
    • Theme is consumed via useTheme() at line 49 — values are read at render time but the upstream signal never fires while the Modal's UIWindow is active
    • ThemeProvider debounces theme changes by 300ms via useDebouncedState at line 16, which could add latency even when the signal does propagate
    • PR fix: use in-app VisionCamera for chat attachment photos #87681 introduced this component; the issue is reproducible in staging only (new feature, not in prod)

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. Beamanator commented on May 11, 2026

    @Beamanator
    Contributor

    Looks like this is working well on staging!

    ScreenRecording_05-11-2026.17-06-18_1.MP4
  8. m-natarajan commented on May 11, 2026

    @m-natarajan

    Not 100% sure to say this issue not reproducible because i can see different behavior while using build v9.3.69-17.
    background automatically change when we turn on/off dark mode , but the viewfinder camera have the same color theme

    ScreenRecording_05-12-2026.05-52-22_1.MP4
  9. Beamanator commented on May 11, 2026

    @Beamanator
    Contributor

    yeah i think that ^ is good enough to prove it's fixed!

  10. removed
    DeployBlockerCash
    on May 11, 2026
  11. added
    Daily
    and removed
    Hourly
    on May 11, 2026
  12. melvin-bot commented on May 11, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.69-18 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-18. 🎊

    For reference, here are some details about the assignees on this issue:

  13. changed the title [-]iOS - Camera - App theme does not change while on camera mode[/-] [+][Due for payment 2026-05-18] iOS - Camera - App theme does not change while on camera mode[/+] on May 11, 2026
  14. melvin-bot commented on May 11, 2026

    @melvin-bot

    @ShridharGoel The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. changed the title [-][Due for payment 2026-05-18] iOS - Camera - App theme does not change while on camera mode[/-] [+][Due for payment 2026-05-20] [Due for payment 2026-05-18] iOS - Camera - App theme does not change while on camera mode[/+] on May 13, 2026
  16. melvin-bot commented on May 13, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-20. 🎊

    For reference, here are some details about the assignees on this issue:

  17. melvin-bot commented on May 13, 2026

    @melvin-bot

    @ShridharGoel The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions