【发布时间】:2020-07-04 16:47:56
【问题描述】:
这是我的代码。在“NewUserVerify”上只需加载“NewProfile”,并在此屏幕上一直允许向后滑动。我做错了什么?
const VerifyNewUserStackScreen = () => (
<Stack.Navigator initialRouteName="NewUserVerify"
screenOptions={{
gestureEnabled: false,
swipeEnabled: false
}}
>
<Stack.Screen name="NewUserVerify"
component={VerifyNewUser}
/>
<Stack.Screen name="NewProfile"
component={NewProfile}
options={{
headerShown: false,
gestureEnabled: false
}}
screenOptions={{
gestureEnabled: false,
swipeEnabled: false
}}
/>
<Stack.Screen name="Home"
component={TabStackScreen}
/>
</Stack.Navigator>
)
【问题讨论】:
-
当您导航到 NewProfile 时,重置索引。
-
感谢您的回答,这样做是有道理的。我试过了,但现在给出了一个错误,我读到它并没有找到任何东西 //reactnavigation.org/docs/3.x/stack-actions/#reset -> 给我一个错误“任何导航器都没有处理“导航/重置”操作。 // reactnavigation.org/docs/1.x/navigation-actions/#reset-> TypeError: undefined is not a function (near'..._reactNavigation.NavigationActions.reset
-
我复制了链接,因为我在 if/else 中重定向到 NewProfile 或 Home 的代码与示例完全相同,只是更改了 routeName
-
您使用的是第 5 版导航但正在阅读第 3 版的文档?
-
我很尴尬,我没有注意到它。但是我现在使用新版本 reactnavigation.org/docs/stack-actions/#replace 并继续允许滑动
标签: react-native react-navigation react-native-ios react-native-navigation