从底部选项卡导航器单击导航堆栈的某个组件时如何返回到该组件
我的React Native应用具有以下结构:
- 底部标签导航器
- 堆栈导航器1
- 屏幕a
- 屏幕B
- 堆栈导航器2
- 堆栈导航器1
因此,我从底部选项卡导航器单击堆栈导航器1,然后转到屏幕A,进行屏幕B,然后将其关闭。当我再次单击堆栈导航器1时,屏幕B显示。 “重置”它的最佳方法是什么,因此每次打开堆栈导航器1时,都会显示A屏幕?
“底部”选项卡导航器中的当前代码:
<Tab.Navigator>
<Tab.Screen
name="Stack"
component={StackNavigator1}
/>
<Tab.Screen
name="Other"
component={Other}
/>
/>
使屏幕成为stacknavigator的初始路由。
My React Native app has this structure:
- Bottom Tabs Navigator
- Stack Navigator 1
- Screen A
- Screen B
- Stack Navigator 2
- Stack Navigator 1
So I click on Stack Navigator 1 from the bottom tab navigator and go to Screen A, to Screen B, then close it. When I click Stack Navigator 1 again, Screen B shows up. What is the best way to "reset" it so every time I open Stack Navigator 1, Screen A shows up?
The current code in the Bottom Tabs Navigator:
<Tab.Navigator>
<Tab.Screen
name="Stack"
component={StackNavigator1}
/>
<Tab.Screen
name="Other"
component={Other}
/>
/>
Making Screen A the initial route of StackNavigator does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
”)到任何关闭屏幕B.
添加
导航(“ screena 它被打开。
Add
navigate("ScreenA")
to whatever closes Screen B. For instance, if Screen B is closed by a button:The user will not see Screen A, but the stack will open on Screen A next time it is opened.