Skip to content

[Flat Nav R5.1c] Keep Search mounted when switching between Expenses and Reports - #107108

Merged
mountiny merged 29 commits into
Expensify:mainfrom
software-mansion-labs:feat/flat-nav-r5.1c
Dec 1, 2026
Merged

mountiny merged 29 commits into
Expensify:mainfrom
software-mansion-labs:feat/flat-nav-r5.1c

Conversation

@sumo-slonik

@sumo-slonik sumo-slonik commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Flat Nav R5.1c, behind the flatNav beta, iOS and Android in a narrow layout.

R5.1b moves Search to another native tab on every switch between Expenses, Reports and More, which remounts it and leaves the screen empty for seconds. This PR keeps Search mounted.

  • iOS: the selected tab shows the native view of Search (react-native-screens patch 014), so every item stays a native tab and the tab bar animates as before. Patch 013 stops the selection lens from wobbling on a tap on More.
  • Android: the tab with Search and the tab of the new section trade places in the bar (react-native-screens patch 012).
  • Bottom-tabs patch 008 holds the JS side of both.
  • The bar changes the search of the mounted Search page with PUSH_PARAMS, as its type tabs do, instead of pushing a second Search page.
  • Without the beta, patches 013 and 014 and the reordering in patch 012 do nothing. The rest of patch 012 applies to every Android tab bar: icons loaded before are set right away from a cache instead of after a decode, and a rebuilt menu is restyled once the update is done, so its items do not blink.
  • SearchResultsSwap now wraps the results of Search on wide and narrow layouts for every user, with or without the beta. When the search changes, the previous results stay on screen until the new ones lay out, instead of an empty list in between.

On an iOS 26.3 simulator (dev build) a switch between Expenses and Reports went from 3.8 to 5.4 s to 0.1 to 0.7 s.

Known limitations:

  • On Android the highlight moves to a tapped item once JS handles the tap, so it can lag while JS is busy.
  • When the new search has no cached results, Search shows an empty list for a moment around its skeleton.

Fixed Issues

$ #105631
PROPOSAL: N/A

Tests

  1. On iOS or Android, switch flatNav on in Account > Troubleshoot > Beta overrides.
  2. Tap Expenses and Reports back and forth. Verify the Search header stays, only the list changes, the highlight follows the tapped item and the screen is never empty.
  3. Tap Home, then Reports, then Home, then Expenses. Verify Search shows right away each time.
  4. Tap More and pick Saved, then Insights, then tap Expenses. Verify More is highlighted for Saved and Insights, and that Expenses shows a list skeleton and then the expenses list.
  5. Rotate the device on Expenses and verify the list fills the screen.
  6. Switch flatNav off and verify the bar shows Home, Inbox, Spend, Insights and Workspaces and works as before.
  • Verify that no errors appear in the JS console

Offline tests

Go offline with the beta on, repeat steps 2 and 3, and verify Search opens from cached data.

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

@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. ⚠️

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
src/components/Search/SearchResultsSwap.tsx 100.00% <100.00%> (ø)
...nents/Search/SearchWithNavigationDeferredMount.tsx 73.91% <100.00%> (+1.18%) ⬆️
src/components/TabSelector/TabSelectorContext.tsx 100.00% <100.00%> (+41.50%) ⬆️
src/components/TabSelector/scrollToTab/index.ts 100.00% <100.00%> (ø)
...rs/NativeTabNavigator/FlatNavTabPressListeners.tsx 100.00% <100.00%> (ø)
...avigators/NativeTabNavigator/nativeTabItemUtils.ts 100.00% <100.00%> (ø)
src/libs/SearchNavigationUtils.ts 100.00% <100.00%> (ø)
src/pages/Search/SearchPageWide.tsx 95.45% <100.00%> (ø)
src/pages/Search/SearchPageNarrow/index.tsx 87.61% <96.42%> (+0.05%) ⬆️
src/components/Search/index.tsx 77.33% <77.77%> (+<0.01%) ⬆️
... and 1 more
... and 58 files with indirect coverage changes

@sumo-slonik sumo-slonik changed the title [Flat Nav R5.1c] Keep Search mounted when switching between Expenses and Reports [HOLD #106500] [Flat Nav R5.1c] Keep Search mounted when switching between Expenses and Reports Nov 17, 2026
Comment thread src/libs/SearchNavigationUtils.ts Resolved
Comment thread patches/react-native-screens/details.md Resolved
…ses and Reports, by trading the places of the native tab items
…d Search view in the selected one, so the tab bar lens animates as before
…nd Reports, and keep the tab patches inert without flat nav
…bar, as its type tabs do, instead of pushing a new page
…n iOS, date presets and tests for the mounted Search page path
…tch the Search skeleton offset, share the section resolver
@sumo-slonik
sumo-slonik marked this pull request as ready for review November 19, 2026 22:21
@sumo-slonik
sumo-slonik requested review from a team as code owners November 19, 2026 22:21
@expensify-chore-bot
expensify-chore-bot Bot requested review from Krishna2323 and removed request for a team November 19, 2026 22:21
# Conflicts:
#	patches/react-native-screens/details.md
#	src/libs/Navigation/AppNavigator/Navigators/TabNavigator.native.tsx
…, and pass the safe area reach in TabSelectorContextTest

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

NAB: @sumo-slonik Could you please update the description? The patch numbers changed: iOS hosted content is 014, the lens taps are 013 and the Android order is 012.

Also, patch 012 is not a no-op without the beta: the icon bitmap cache and the menu settle after a rebuild apply to every Android tab bar. And SearchResultsSwap now wraps Search on wide and narrow pages for all users, which is worth a line too.

@Krishna2323

Copy link
Copy Markdown
Contributor

@sumo-slonik On iOS, Expenses still shows the blank header and list skeleton in this flow:

  1. Tap More > a saved search.
  2. As soon as it shows, tap More > Workspaces.
  3. Once Workspaces opens, tap Expenses.
Monosnap.screencast.2026-11-27.20-17-35.mp4

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

NAB: @sumo-slonik Could you please update the description? The patch numbers changed: iOS hosted content is 014, the lens taps are 013 and the Android order is 012.

Also, patch 012 is not a no-op without the beta: the icon bitmap cache and the menu settle after a rebuild apply to every Android tab bar. And SearchResultsSwap now wraps Search on wide and narrow pages for all users, which is worth a line too.

I'm on it

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@sumo-slonik On iOS, Expenses still shows the blank header and list skeleton in this flow:

  1. Tap More > a saved search.
  2. As soon as it shows, tap More > Workspaces.
  3. Once Workspaces opens, tap Expenses.

Monosnap.screencast.2026-11-27.20-17-35.mp4

I'm on it

…rts no longer show a blank header and skeleton
@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@Krishna2323 Both should be fixed, can you retest it?

@Krishna2323

Copy link
Copy Markdown
Contributor

@sumo-slonik On Android, after a fast More > saved search > Reports, the tab row in the header stays scrolled where the saved search was, so the selected Reports tab is off screen. It happens sometimes, not every time.

Monosnap.screencast.2026-11-28.01-52-13.mp4

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@Krishna2323 Fixed, could you retest?

@Krishna2323

Copy link
Copy Markdown
Contributor

@sumo-slonik I can still repro empty header on android:

Monosnap.screencast.2026-11-30.23-54-45.mp4

…re after a saved search no longer shows a blank header
@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@Krishna2323 Fixed, Search now shows with its header right away. The previous search can still flash briefly before the new list, but that is outside the scope of this PR. Could you retest?

@Krishna2323

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_native.mp4
Android: mWeb Chrome
android_mWeb.mp4
iOS: HybridApp
ios_native.mp4
iOS: mWeb Safari
ios_mWeb.mp4
MacOS: Chrome / Safari
web_chrome.mp4

@Krishna2323 Krishna2323 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!

@sumo-slonik, there are some conflicts to resolve, but approving anyway.

@melvin-bot
melvin-bot Bot requested a review from mountiny December 1, 2026 12:08
# Conflicts:
#	src/libs/Navigation/AppNavigator/Navigators/TabNavigator.native.tsx
#	src/libs/SearchNavigationUtils.ts
#	src/pages/Search/SearchPageNarrow/index.tsx
#	src/pages/Search/SearchPageWide.tsx

@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 for the changes and testing @Krishna2323

I would really want to make sure we follow up on all the patches so we can eventually remove them, I dont want to keep this around forever

- On Android the two tabs trade their places in the bar (the `tabBarItemOrder` prop of react-native-screens patch 012) and each draws the item of the other, so the bar highlights the named host over content that never moved. Native reports a tab by its screen key, so the `tabPress` event and the navigation go to the route whose item the tab draws. A tab trades with one tab at a time and the focused route goes first. A new `tabBarItemHiddenRouteName` option names the hidden route a press on a visible tab's item opens. While that route is drawn in another tab, native does not select the pressed tab, which would show empty until JS answers. The bar shows the pressed item selected over the hidden route in a commit of its own, and the `tabPress` event is sent in the next task, because native mounts a commit only when the task that made it ends and the render of the navigation would hold the bar back. A press that starts no navigation puts the bar back, and one whose navigation never names the pressed item expires after 2 s.
- While it is not focused, a hidden route is laid out only under an item that shows it rightly: the host it names has to be its own tab or a tab whose item opens it, and its tab has to hold the item of that host on Android or show no view of another tab on iOS. Native shows a tab as soon as its item is tapped, so the route is also laid out in its own tab while the item that tab holds opens it, whichever host it names: Search on a saved search, which names More, shows under Expenses at once when it is drawn there, and on Android also under Reports while the tab of Search holds the Reports item of a pending press. Under any other item the tab shows its own content, such as the Search skeleton of the Expenses and Reports placeholders, until JS answers the tap.
- Without a hidden route that has a host, no order, no source key and no tap interception are sent and nothing changes.
- Upstream PR/issue: not reported, because it builds on patch 003, which has no upstream counterpart.

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.

@sumo-slonik Can we follow up on this? ideally we dont have patches forever

### [react-native-screens+4.28.0+012+tab-bar-item-order.patch](react-native-screens+4.28.0+012+tab-bar-item-order.patch)

- Reason: Android only. Adds a `tabBarItemOrder` prop to the tabs host: the screen keys in the order their items take in the tab bar. With the flat navigation beta, Expenses and Reports are two items over the one Search screen, and native shows the content of a tab only under its own item, so the tab that holds Search has to take the place of the item to highlight. Moving the tab in React replaces its fragment, which remounts Search. With this prop the React children keep their order, so no view is moved or recreated: the menu items are added in that order and, only when an order is given, the selected one is checked again after the menu is rebuilt. `TabsHostA11yCoordinator` paired tabs with menu items by index, so it now matches them by menu item id. A rebuilt menu has new item views: Material fades them in, React Native lays them out only on a later frame and Material sizes their active indicators later still, so once the update is done the patch ends that fade, lays the bar out and sizes the indicators itself. The rebuilt menu also selects its first item, so the place that was selected is selected again without an animation before the selected tab, and the indicator moves from there as it does on a tab switch. A tab that takes another place takes that item's icon in the same update, and a decode lands a few frames later, so the bitmaps of tab icons loaded before are kept and set right away. An empty or missing order keeps the order of the children, which is what every host gets without the beta. iOS does not use the order, see patch 014.
- Upstream PR/issue: not reported yet.

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.

@MelvinBot can you create Weekly issue and assign @mountiny @sumo-slonik to report all the patches from the Flat nav prs upstream and track them being removed eventually

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.

Created Upstream dependency patches and track their removal, labeled Weekly and assigned to mountiny and sumo-slonik.

Includes an initial patch inventory and tracking for upstream reports, releases, and eventual patch removal.


view run

@mountiny
mountiny merged commit c0153ba into Expensify:main Dec 1, 2026
51 of 52 checks passed
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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

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

@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

🚀 Deployed to staging by https://github.com/mountiny 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 — the navigation changes remain behind the flatNav beta, while changes available to everyone only improve rendering and performance without 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.

6 participants