fix(ios): gate index>=4 appear-select on >5-tab overflow#526
Open
davidecallegaro wants to merge 1 commit into
Open
fix(ios): gate index>=4 appear-select on >5-tab overflow#526davidecallegaro wants to merge 1 commit into
davidecallegaro wants to merge 1 commit into
Conversation
TabAppearModifier force-selected any tab with index >= 4 on appear to sync selection for tabs under the system More tab. That overflow only exists with more than 5 visible tabs, so on a 5-tab bar the 5th tab (index 4) hijacked the selection whenever its scene re-appeared (e.g. when the tab bar is re-shown after .hideTabBar), causing a phantom tab switch that JS can't correct. Gate the force-select on filteredItems.count > 5. Fixes callstack#525. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #525.
On iOS,
TabAppearModifierforce-selects any tab withindex >= 4inonAppearto sync selection for tabs nested under iOS's "More" overflow tab. That overflow only exists when there are more than 5 visible tabs. With exactly 5 tabs there is no More tab, yet the 5th tab (index 4) still matchesindex >= 4, so it steals the selection whenever its scene re-appears — most visibly when the tab bar is re-shown after a screen hid it via.hideTabBar— causing a phantom tab switch that JS can't correct (selectedPageis a value-diffed controlled prop).Change
Gate the force-select on actual overflow (
filteredItems.count > 5), so it only runs when a real "More" tab exists.Behavior
Testing
Verified on a 5-tab app (
@bottom-tabs/react-navigation+ expo-router) with a real device build: returning from atabBarHiddenscreen no longer jumps to the 5th tab; normal tab switching and the >5-tab More flow are unaffected.