Skip to content

fix: add iPhone Duo support - #104730

Merged
mountiny merged 39 commits into
Expensify:mainfrom
software-mansion-labs:war-in/fix-iphone-duo-nav-layout
Nov 17, 2026
Merged

mountiny merged 39 commits into
Expensify:mainfrom
software-mansion-labs:war-in/fix-iphone-duo-nav-layout

Conversation

@war-in

@war-in war-in commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

On the folded iPhone Duo, iOS puts the tab bar in a column in the right safe area. The app root no longer pads the horizontal safe area; each root screen pads itself (HorizontalSafeArea in screenLayoutWrapper), and on iOS the tab host spans the window so the bar sits in the inset. Also fixes FAB position, landscape keyboard dismiss and scroll indicator offset.

Fixed Issues

$ #102090
PROPOSAL:

Tests

  1. On the iPhone Duo simulator (folded), open the app on the Workspaces tab

  2. Verify that the tab bar is a column of icons in the right inset below the status bar, and the content uses the full width left of it

  3. Verify that the camera and + floating buttons sit inside the content, not over the tab bar

  4. Unfold the device (open posture) and verify the same layout in landscape: tab column in the right inset, content not under it

  5. On the iPhone Duo simulator (folded), open a chat and tap its header to open the Details RHP

  6. Scroll the page

  7. Verify that the scroll indicator is at the right edge of the content, not ~84pt to the left of it

  8. Go to Account settings (avatar) and verify the same for its scroll indicator

  9. On an iPhone with a notch, rotate to landscape and open a chat

  10. Focus the composer so the keyboard shows, then tap the side safe area left of the content

  11. Verify that the keyboard is dismissed

  12. Hide the keyboard and tap a tab bar item in the inset; verify that the tab changes

  13. On Android (3-button navigation), rotate to landscape and verify content is not covered by the navigation bar or camera cutout

Offline tests

N/A

QA Steps

Same as tests

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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/App.tsx 100.00% <ø> (ø)
src/components/CenteredModalLayout/index.tsx 100.00% <100.00%> (ø)
...lapsibleHeaderOnKeyboard/CollapsibleHeaderView.tsx 100.00% <100.00%> (ø)
...ts/HorizontalSafeArea/HorizontalSafeAreaContext.ts 100.00% <100.00%> (ø)
src/components/HorizontalSafeArea/index.native.tsx 100.00% <100.00%> (ø)
src/components/LHNOptionsList/LHNOptionsList.tsx 79.48% <100.00%> (+0.53%) ⬆️
src/components/Modal/BaseModal.tsx 98.72% <100.00%> (+<0.01%) ⬆️
src/components/ScrollView.tsx 100.00% <100.00%> (ø)
...Search/SearchPageHeader/SearchFiltersBarNarrow.tsx 84.00% <100.00%> (+2.18%) ⬆️
src/components/SplashScreenHider/index.native.tsx 96.15% <100.00%> (-0.15%) ⬇️
... and 23 more
... and 11 files with indirect coverage changes

@war-in

war-in commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@claude review
@MelvinBot review

1 similar comment
@war-in

war-in commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@claude review
@MelvinBot review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T16:28:17.140675Z 8d0cea9 Manual request
ℹ️ 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.

@war-in

war-in commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@claude review
@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

I found no blocking issues. There are two things to fix or verify on an iOS device, plus one small behavior change.

1. The tab bar shape is misread on mount. It flashes as a column on every iPhone.
In TabBarShapeProbe.tsx:22, the nested <SafeAreaProvider> has no initialMetrics. That means it starts with its parent's insets (SafeAreaContext.tsx:44: initialMetrics?.insets ?? initialSafeAreaInsets ?? parentInsets). So on the first effect, tabScreenBottomInset === windowBottomInset is always true and isTabBarVertical becomes true. The bar shows icons only, without labels, until the native inset event flips it back. This happens on app start and when each tab screen first mounts. It may also happen when shouldShowNativeTabBar goes false → true, if a hidden bar leaves the inset stale.
Suggested fix: ignore readings until the probe's provider has reported real metrics. For example, skip the update while the probe's inset still equals the parent's, and only set the value from an onInsetsChange / layout-driven reading.

2. Removing the global scrollIndicatorInsets workaround may bring back an old bug.
ScrollView.tsx:16 drops {right: Number.MIN_VALUE}, and so does DynamicNewTaskPage. That workaround was for [HOLD for payment 2023-12-04] [$500] iOS - Task - Scroll bar in the task confirmation page is on the left. That bug happened in portrait during the push animation, where the horizontal insets are 0. So the first-frame inset timing that HorizontalSafeArea fixes doesn't obviously cover it. Please re-run the steps from that issue on a portrait iPhone: open the task confirmation page with a long description.

3. Minor behavior change: iOS centered modals in landscape. The DismissibleBackdrop in CenteredModalLayout/index.tsx now sits inside the root-screen margins. As a result:

  • Tapping the dimmed side strips no longer closes the modal.
  • The bottom-docked card no longer reaches the screen edges.

The dim itself still covers the full window, and Android already behaved this way. This is probably fine, but please confirm it's intended.

Checked and OK
  • Onboarding wrapper: OnboardingModalNavigatorContentWrapper/index.tsx still resolves on iOS with the same stopPropagation and styles. The deleted iOS file only added padding.
  • No double inset: nested navigators have a parent, so they're skipped. PublicScreens and the MFA navigator (which uses its own NavigationIndependentTree) each get exactly one inset. On Android the tab host is wrapped; on iOS each tab screen is wrapped instead.
  • Insets come from the window: @hooks/useSafeAreaInsets wraps the library hook. SafeAreaProviderCompat in the native bottom tabs doesn't add a provider when one already exists. So HorizontalSafeArea reads window insets, and only the probe's own provider reads tab-screen insets.
  • Global UI outside navigation: Growl, portals, the RN Modal popovers, and the full-screen overlays don't end up under the notch. getSplashScreenHiderPosition was the only code that compensated for the old root padding, and this PR removes it.
  • Android: useNativeTabBarOptions/index.android.ts ignores isTabBarVertical. A side 3-button nav bar can flip the flag, but that only costs an extra re-render.
  • renderTabScreenLayout: it's recreated every render, but it's called as a function with stable element types, so screens don't remount.

view run

@MelvinBot

Copy link
Copy Markdown
Contributor

My review above already covers the latest commit (f7d7aef6). Nothing has changed since then, so I have no new findings. Ask me again after you push new commits.


view run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7d7aef67a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@war-in

war-in commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@MelvinBot review
@codex review
@claude review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review (06798f29)

The new commits fix the first-render label flash I raised last time. SafeAreaListener has no initial value, so the probe now waits for a real native reading. The probe still has one issue, and two items from my last review are still open.

1. Labels can flash off every time the tab bar comes back.
In TabBarShapeProbe.tsx:28-33, the effect skips while the bar is hidden, but onChange still stores readings. On iOS 18+, RNScreens hides the bar with setTabBarHidden:animated:, which removes the bar from the tab screen's safe area. Your comment on line 29 assumes this too.

Here is what happens when you open a chat and go back to the Inbox:

  1. While the chat is open, the probe stores bottom === windowBottomInset.
  2. When isTabBarShown flips to true, the effect runs right away with that stale value and calls setIsTabBarVertical(true).
  3. The labels are dropped, and the icons are rasterized again without them.
  4. The bar's show animation fires onChange with the real inset, and the labels come back.

This would hit every iPhone on iOS 18+ in portrait. Please check it on a device.

Suggested fix: only trust readings taken while the bar was shown. For example, store {bottom, isTabBarShown} in onChange, and skip the effect unless the stored reading has isTabBarShown: true.

2. Still open: removing the scrollIndicatorInsets workaround.
ScrollView.tsx:16 and DynamicNewTaskPage still drop {right: Number.MIN_VALUE}. That workaround fixed [HOLD for payment 2023-12-04] [$500] iOS - Task - Scroll bar in the task confirmation page is on the left, which happened in portrait, where horizontal insets are 0. Please re-run that issue's steps on a portrait iPhone.

3. Still open: please confirm this is intended. On iOS in landscape, centered modals (CenteredModalLayout/index.tsx:45-58) no longer close when you tap the side strips. Also, the bottom-docked card no longer reaches the screen edges.

Checked and OK in the new commits
  • Tab host split: on Android, TabHostHorizontalSafeArea insets the whole host. On iOS, the host spans the window, and TabScreenHorizontalSafeArea insets each tab instead. Nested navigators have a parent, so screenLayoutWrapper skips them. No screen gets inset twice.
  • Floating buttons: on iOS, useFloatingButtonsHorizontalInsets uses the window insets, which matches a host that spans the window. Other platforms get 0 because the host is already inset.
  • Wide layout: the TabNavigatorBar side bar in NativeTabLayout can't land under the notch, because native useResponsiveLayout always reports a narrow layout.
  • GenericErrorPage: it's only used as the app-level ErrorBoundary fallback, which sits inside the root SafeAreaProvider, so wrapping it is correct. The full-screen loader overlay is still centered on the window rather than the content. That's cosmetic.
  • Web: HorizontalSafeArea and LandscapeKeyboardDismissAreas don't change anything on web, so web behavior is unchanged.

view run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06798f29e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@war-in
war-in marked this pull request as ready for review October 23, 2026 12:59
@war-in
war-in requested review from a team as code owners October 23, 2026 12:59
@melvin-bot
melvin-bot Bot requested review from truph01 and removed request for a team October 23, 2026 12:59
@melvin-bot

melvin-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

@truph01 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]

@OSBotify

Copy link
Copy Markdown
Contributor

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

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR fixes device-specific navigation layout and safe-area handling without adding a new workflow or changing the steps users follow.


view run

@mitarachim

Copy link
Copy Markdown

The Deploy blocker issue #107195 didn't happen in previous PRs. I also couldn't reproduce it with an ad hoc build in this PR because the app always crashes right after login.
Could you please double check if it's not introduced by #104730

@mitarachim

Copy link
Copy Markdown

The Deploy blocker issue #107197 didn't happen in previous PRs. I also couldn't reproduce it with an ad hoc build in this PR because the app always crashes right after login.
Could you please double check if it's not introduced by #104730

@mitarachim

Copy link
Copy Markdown

The Deploy blocker issue #107227 didn't happen in previous PRs. I also couldn't reproduce it with an ad hoc build in this PR because the app always crashes right after login.
Could you please double check if it's not introduced by #104730

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.41-2 🚀

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

Bundle Size Analysis (Sentry):

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.

10 participants