[iOS] With 5 bottom tabs, the last bottom tab always pops the stack to top on focus with react-navigation
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- ios, react-native, typescript
- 领域
- mobile
调研方向
从提供的复现开始,使用 createNativeBottomTabNavigator、一个包含五个标签页的导航器,以及最后一个标签页中的原生 stack;在 iOS 上运行,并将其行为与较少标签页时的行为进行比较。跟踪最后一个标签页周围的标签页焦点和 stack 恢复,然后验证返回该标签页时会保留 Details 屏幕,而不会 pop 到 root。
由索引模型根据 Issue 内容生成。
描述
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
On iOS when having 5 bottom tabs, the last bottom tab always pops the native stack to top when used with react-navigation. This does not occur when using less than 5 tabs. Adding popToTopOnFocus={false} to the options does not help. Happens on the latest library version, but also happened on versions 0.4.x. I'm using Expo SDK 54, react-native 0.81.5. @react-navigation/native 7.1.18.
Library version
1.0.2
Environment info
System:
OS: macOS 15.6.1
CPU: (14) arm64 Apple M4 Pro
Memory: 8.34 GB / 48.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.14.0
path: /Users/xxx/.nvm/versions/node/v22.14.0/bin/node
Yarn: Not Found
npm:
version: 10.9.2
path: /Users/xxx/.nvm/versions/node/v22.14.0/bin/npm
Watchman:
version: 2025.09.15.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.0
- iOS 26.0
- macOS 26.0
- tvOS 26.0
- visionOS 26.0
- watchOS 26.0
Android SDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.27812.49.2514.14217341
Xcode:
version: 26.0.1/17A400
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.16
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.2
wanted: latest
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to reproduce
- Create a bottom tab navigator with 5 tabs.
- Make the 5th (last) tab render a native stack with two screens.
- Navigate in the last tab from its root to a second screen.
- Switch to any other tab, then switch back to the last tab
Seems to occur on iOS only
Reproducible sample code
import * as React from 'react';
import { Button, Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createNativeBottomTabNavigator } from '@bottom-tabs/react-navigation';
const Stack = createNativeStackNavigator();
const Tabs = createNativeBottomTabNavigator();
function Screen({ label }: { label: string }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>{label}</Text>
</View>
);
}
function MenuHome({ navigation }: any) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Menu Home</Text>
<Button title="Go to Details" onPress={() => navigation.push('Details')} />
</View>
);
}
function Details() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Details</Text>
</View>
);
}
function MenuStack() {
return (
<Stack.Navigator>
<Stack.Screen name="MenuHome" component={MenuHome} options={{ title: 'Menu' }} />
<Stack.Screen name="Details" component={Details} />
</Stack.Navigator>
);
}
function RootTabs() {
return (
<Tabs.Navigator initialRouteName="Home">
<Tabs.Screen name="Home" children={() => <Screen label="Home" />} />
<Tabs.Screen name="Markets" children={() => <Screen label="Markets" />} />
<Tabs.Screen name="Options" children={() => <Screen label="Options" />} />
<Tabs.Screen name="Blocks" children={() => <Screen label="Blocks" />} />
{/* IMPORTANT: Last tab renders a native stack */}
<Tabs.Screen name="Menu" component={MenuStack} />
</Tabs.Navigator>
);
}
export default function App() {
return (
<NavigationContainer>
<RootTabs />
</NavigationContainer>
);
}
- 主要语言
- TypeScript
- 星标
- 1.5k
- 派生
- 108
- 平均合并
- 22 小时 36 分钟
- 30 天内合并 PR
- 10
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/react-native-bottom-tabs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
callstack/react-native-bottom-tabs#593 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
callstack/react-native-bottom-tabs#560 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
callstack/react-native-bottom-tabs#592 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 68/100
callstack/react-native-bottom-tabs#591 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 58/100
callstack/react-native-bottom-tabs#590 ·
维护者通常 1 天内回复
查看 callstack/react-native-bottom-tabs 的全部 Issue
相似的 Issue
-
triage
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
mermaid-js/mermaid-live-editor#2053 ·
维护者通常 1 天内回复
-
factory
难度 2/5 1-3 小时 新手友好度 82/100
jessepollak/home#1455 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 95/100
lingdojo/kana-dojo#31227 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
appandflow/stim#1838 ·
维护者通常 1 天内回复