Skip to content

Keep the whole side safe area inset on iphone duo - #108207

Merged
lakchote merged 4 commits into
Expensify:mainfrom
software-mansion-labs:@GCyganek/fix-duo-vertical-bar-safe-area-padding
Dec 1, 2026
Merged

lakchote merged 4 commits into
Expensify:mainfrom
software-mansion-labs:@GCyganek/fix-duo-vertical-bar-safe-area-padding

Conversation

@GCyganek

@GCyganek GCyganek commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

On iOS, getPlatformSafeAreaPadding trims side insets to 70%, which suits a notch but not the iPhone Duo's vertical bar (status ring, camera, tab items), so modals put content up to 25pt under it. getPlatformSafeAreaPadding and getModalPaddingStyles now take a hasVerticalBar option and keep the full side inset when it is set.

The callers that use side padding (useSafeAreaPaddings, BaseModal, PopoverWithoutOverlay, the native EmojiPickerMenu, AttachmentCamera and the native UpdateRequiredView) read it from the new useHasVerticalBar hook. The hook subscribes to WindowBarsNitroModule with useSyncExternalStore, so the padding is recomputed when the native bar state changes, even if the insets stay the same. It replaces useIsTabBarVertical, which read the same native state for the tab bar.

Fixed Issues

$ #106382
$ #106386
PROPOSAL: N/A

Tests

#106382:

Precondition:

  • Create a Control workspace.
  • Enable Rules.
  1. Launch Expensify app on iPhone Duo.
  2. Go to workspace settings > Rules.
  3. Go to Card restrictions.
  4. Tap All cards.
  5. Verify "Expensify Cards offer built-in protection" modal does not overlap with device status bar.

#106386:

Precondition:

  • Have at least one workspace.
  1. Launch Expensify app on iPhone Duo.
  2. Go to Account > Subscription.
  3. Tap Explore all plans.
  4. Scroll down the page.
  5. Verify Scroll bar does not overlap with page content.
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

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
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-11-27.at.15.07.55.mov
Screen.Recording.2026-11-27.at.15.09.32.mov
iOS: mWeb Safari
MacOS: Chrome / Safari

@GCyganek
GCyganek requested review from a team as code owners November 27, 2026 14:19
@expensify-chore-bot
expensify-chore-bot Bot requested review from truph01 and removed request for a team November 27, 2026 14:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 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-27T14:34:39.441725Z d8d146e PR opened
ℹ️ 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.

@expensify-chore-bot

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]

@expensify-chore-bot
expensify-chore-bot Bot requested review from trjExpensify and removed request for a team November 27, 2026 14:19
Comment thread src/libs/hasVerticalBar/index.ios.ts Resolved
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...c/components/AttachmentPicker/AttachmentCamera.tsx 88.23% <100.00%> (+0.06%) ⬆️
...nents/EmojiPicker/EmojiPickerMenu/index.native.tsx 96.47% <100.00%> (+0.04%) ⬆️
src/components/Modal/BaseModal.tsx 98.76% <100.00%> (+0.02%) ⬆️
...rBottomContent/useTabBarCoveredHeight/index.ios.ts 100.00% <100.00%> (ø)
src/hooks/useHasVerticalBar/index.ios.ts 100.00% <100.00%> (ø)
src/hooks/useSafeAreaPaddings.ts 100.00% <100.00%> (ø)
...on/AppNavigator/Navigators/TabNavigator.native.tsx 100.00% <100.00%> (ø)
src/pages/signin/SignInPage.tsx 87.26% <100.00%> (ø)
src/styles/utils/index.ts 71.13% <100.00%> (+0.45%) ⬆️
src/components/PopoverWithoutOverlay/index.tsx 0.00% <0.00%> (ø)
... and 2 more
... and 7282 files with indirect coverage changes

@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: d8d146e7b4

ℹ️ 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".

Comment thread src/styles/utils/index.ts Outdated

// The trimmed side insets suit an iPhone's notch, which leaves room beside it. On a foldable iPhone the side inset is the
// vertical bar, which the status bar and bar items fill, so anything less than the whole inset puts content under them.
const sideInsetsPercentage = hasVerticalBar() ? 1 : insetsPercentage;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Subscribe to bar-state changes before deriving side padding

If the native module's first window read completes after the initial render, or verticalBarEdge changes without new insets, consumers such as BaseModal and useSafeAreaPaddings are not notified to recompute this value. modules/ExpensifyNitroUtils/ios/windowbars/HybridWindowBarsModule.swift:80–87,114–119 explicitly handles both situations through listeners, but this path only reads its cached snapshot. With the auto-memoization documented in AGENTS.md, even unrelated renders can retain the old 70% side padding, leaving content under the bar. Subscribe to the native state, as useIsTabBarVertical already does, and make its snapshot an explicit input to the padding calculation.

AGENTS.md reference: AGENTS.md:L70-L70

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. The vertical bar state is now an explicit input: getPlatformSafeAreaPadding takes hasVerticalBar as an option instead of reading the native module, and the callers that use side padding subscribe through useHasVerticalBar (useSyncExternalStore), so they recompute when the native state changes even if the insets stay the same. Added a test for that case in useSafeAreaPaddingsTest.

trjExpensify
trjExpensify previously approved these changes Nov 27, 2026

@trjExpensify trjExpensify 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.

LGTM 👍

@trjExpensify

Copy link
Copy Markdown
Contributor

@Expensify/design should take a look though. 👍

@shawnborton

Copy link
Copy Markdown
Contributor

The space on the right side of the modal here is not correct:

CleanShot 2026-11-27 at 8 24 22 PM@2x

Though we should probably just center that thing up like it's web?

@dubielzyk-expensify

dubielzyk-expensify commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Modals and sheets are a bit weird on the Duo atm but I think what I'd expect according to the HIG and other patterns is that the main body of the sheet should respect the safe zone (which it is in the video), but the illustration should not:

CleanShot 2026-11-30 at 11 58 34 AM

The area on the right is generally reserved for controls. On modals/sheets you can stretch it but that means you need to be careful about the height of the sheets which is why we opted to not do so at least to start with.

The illustration is likely to get real weird in that stretch ratio though when its unfolded. There's neater solutions here to do a smaller width sheet etc, but there's a question of how much we wanna polish this for now. I'd say maybe having a max-width on the modal in landscape seems sensible though:

CleanShot 2026-11-30 at 12 03 07 PM

@GCyganek

Copy link
Copy Markdown
Contributor Author

👀 I agree now looking at it we can skip safe area inside modals when unfolded as most modals will cover the vertical bar with controls anyway (only status bar is always on top) so I will take a closer look at it in a moment

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Since we have a max-width on desktop anyways it might be just ensuring that this also applies in unfolded mode as well

@GCyganek

Copy link
Copy Markdown
Contributor Author

Can we continue this discussion on #108221 where I'm updating the logic to treat unfolded landscape on iphone duo as landscape on tablets like ipad?

This PR only fixes the problem where safe area is not applied correctly on iphone duo because we have 0.7 multiplier that only makes sense on normal phones so we can just merge this one and continue working on modal layouts on that other PR that will change them anyway in unfolded landscape. This way we won't duplicate our work.

On that PR I can change layout of unfolded landscape modals to something like this:

Screenshot 2026-11-30 at 11 09 14

in portrait we can stay with full width no safe area insets as we do not have high enough bottom docked modal to overlap status ring I believe. Or we can set some max-width, depends what you prefer:

Screenshot 2026-11-30 at 11 13 55

I'm wondering though if we want to do something with unfolded landscape onboarding flow as it will look like this (the same as on ipads currently in landscape mode):

Screenshot 2026-11-30 at 11 10 10

@shawnborton

Copy link
Copy Markdown
Contributor

Don't mean to derail you all but we should also look at the header area and use the "wide" header styles (side-by-side buttons on the right side of header, not full width)

CleanShot 2026-11-30 at 11 28 24 AM@2x

Agree with your other point though. Just kinda feels like we can treat some of these elements the same way we would on a wide device.

@GCyganek

Copy link
Copy Markdown
Contributor Author

Don't mean to derail you all but we should also look at the header area and use the "wide" header styles (side-by-side buttons on the right side of header, not full width)

Thanks, I missed that the logic for deciding whether header buttons are displayed in separate row or not checks if the device is in landscape mode and #108221 would change it from true to false, but fixing it to keep the header buttons in the same row will not be hard so will do that, I just wanted to show you how modals can look after this change

@GCyganek

Copy link
Copy Markdown
Contributor Author

Anyway, if you are ok with this, I would allow C+ to review this PR so we can merge it quickly and I will work on modal layouts and safe area inside modals here #108221

@truph01

truph01 commented Dec 1, 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 proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained """"why"""" the code was doing something instead of only explaining """"what"""" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 that this PR follows the guidelines as stated in the Review Guidelines
  • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • 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.
  • 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: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-12-01.at.11.21.53.mov
Screenshot 2026-12-01 at 11 20 20
iOS: mWeb Safari
MacOS: Chrome / Safari

Comment thread src/styles/utils/index.ts Outdated
insets: EdgeInsets;

/** Whether the side inset is a foldable iPhone's vertical bar, read with useHasVerticalBar. The whole side inset is kept then. */
hasVerticalBar?: boolean;

@truph01 truph01 Dec 1, 2026 •

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.

NAB:

It's optional and defaults to false, so a new caller of getModalPaddingStyles could leave it out and bring back the Duo overlap without a type error.

Both current callers already pass it. So should we make it required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

@melvin-bot
melvin-bot Bot requested a review from lakchote December 1, 2026 08:30

@lakchote lakchote 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.

Looks good, thanks! Agreed on moving the modal layout changes to #108221.

@lakchote
lakchote merged commit 7568591 into Expensify:main Dec 1, 2026
51 of 53 checks passed
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@OSBotify

OSBotify commented Dec 1, 2026

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.

@OSBotify OSBotify mentioned this pull request Dec 1, 2026
90 tasks done
@OSBotify

OSBotify commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/lakchote in version: 9.5.57-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR fixes content overlapping the iPhone Duo’s vertical bar, restoring expected layout without adding a feature, changing workflows, or making existing article instructions incorrect.


view run

@OSBotify

OSBotify commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/roryabraham in version: 9.5.57-3 🚀

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.

8 participants