Repository navigation
Conversation
Turning the Insights beta on or off swaps which tab has no native bar item. Android cannot remove a native tab in place, so the host kept a stale tab and crashed when shown again. Key the host by the hidden route names so it is replaced with a fresh one instead. Co-authored-by: daledah <daledah@users.noreply.github.com>
Co-authored-by: daledah <daledah@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
@MelvinBot please merge main |
…aToggleCrash Co-authored-by: daledah <daledah@users.noreply.github.com>
|
@MelvinBot please merge main and open this PR |
…aToggleCrash Co-authored-by: daledah <daledah@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67fd42e70f
ℹ️ 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".
| const nativeSelectedScreenKey = state.routes.find(route => route.key === nativeSelectedRouteKey)?.name ?? nativeSelectedRouteKey; | ||
| + // Android cannot remove a native tab in place, so a change in which routes are hidden would leave the host with a | ||
| + // stale tab and crash it. Keyed by the hidden route names, the host is remounted with the new set of tabs instead. | ||
| + const nativeTabsHostKey = `native-tabs-host-${state.routes.filter(isRouteHidden).map(route => route.name).join(',')}`; |
There was a problem hiding this comment.
Consolidate the duplicate native-host remount
When the hidden route changes in production, NativeTabLayout.tsx already derives the same route-name key at lines 22–25 and applies it to the View containing children at lines 31–35, so NativeBottomTabView and its Tabs.Host are unmounted before this new host key can be reconciled against its previous value. The added test misses this because it renders NativeBottomTabView directly without the production layout. Remove either the existing layout-level workaround or this patch; as written, the commit adds a dependency patch that changes no production behavior and leaves two implementations to maintain.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Codex is right: this patch is now redundant. main already has the same fix at the layout level, so the patch changes nothing in production.
[Liquid Glass Follow Up] Fix native tab bar issues when the Insights beta is on merged on Oct 21, after this PR was opened. It keys the View around children by the names of routes with tabBarItemHidden (NativeTabLayout.tsx:22-35). The patch's isRouteHidden reads the same tabBarItemHidden option and builds the same name list. So when the Insights beta changes, the layout remounts NativeBottomTabView and its Tabs.Host before the new host key is ever compared. The new unit test misses this because it renders NativeBottomTabView without NativeTabLayout.
I recommend you close this PR rather than keep two copies of the fix. Before you do, confirm on Android that the crash in [$175] Android - Troubleshoot - App crashes after "Insigths Page" beta is disabled. no longer happens on main. That merged PR doesn't list this issue, and I can't test Android in this run.
If the crash still happens, reply with @MelvinBot and I'll investigate. If you'd rather keep the PR, I can remove the layout-level key instead.
|
Looks like this issue was handled in this PR, so I’m closing it. |
Explanation of Change
The native tab bar shows five of the six tabs, and the Insights beta decides which tab gets no bar item: Account with the beta, Insights without it. The
hidden-tab-itemspatch renders noTabs.Screenfor that tab. So turning the beta on or off removes one native tab from theTabs.Hostand inserts another.Android cannot remove a native tab in place (
TabsHostViewManagerdoes not overridegetChildAt/getChildCount, as documented for thestable-native-tab-identitypatch). The host kept a stale tab, and its selected tab pointed at it. The app crashed when the host was shown again after the user left Beta overrides.This PR adds
@react-navigation+bottom-tabs+7.19.2+005+remount-native-tabs-host-on-hidden-change.patch. It keysTabs.Hostby the hidden route names instead of the fixed"native-tabs-host". When the set of hidden routes changes, React replaces the whole host with a fresh one that has the right tabs, so no tab is removed in place. Route re-keys (markFocusedTabRouteForRemount) don't change the route names, so they don't remount the host. The beta rarely changes, so remounting the tab contents then is acceptable.A unit test in
tests/unit/NativeBottomTabViewTest.tsxchecks that the host remounts when a different route is hidden, and doesn't remount when only a route key changes. The new test fails without the patch.Fixed Issues
$ #104280
PROPOSAL: #104280 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.AI Tests
Run locally by MelvinBot:
npm test -- tests/unit/NativeBottomTabViewTest.tsx: 3/3 passed. The new test fails without the patch, as expected.git applyof patch 005 on top of patches 001–004: applies and reverses cleanly. The base blob hash matches patch 004's result../scripts/validatePatches.sh: passed.npm run typecheck: passed.npm run lint-changed: passed.npm run spell-changed: passed.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari