【问题标题】:Lost the back button React Native Navigation丢失后退按钮 React Native Navigation
【发布时间】:2020-08-06 21:39:38
【问题描述】:

我对 react 原生导航栏有疑问。在第三个屏幕(堆栈导航器中的“Auth”)后退按钮上,我丢失了后退按钮。我该如何解决?

我用这个函数来导航:

this.props.navigation.navigate("Choose")
this.props.navigation.navigate("Auth")

NavigationContainer 代码:

<View style={styles.container}>
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Root" component={Hello} />
        <Stack.Screen name="Choose" component={ChooseMessengers} />
        <Stack.Screen name="Auth" component={Auth} />
      </Stack.Navigator>
    </NavigationContainer>
    <StatusBar style="auto" />
</View>

【问题讨论】:

    标签: javascript react-native react-navigation


    【解决方案1】:

    要拥有后退按钮,您必须将屏幕推送到堆栈顶部。

    this.props.navigation.push("Auth")
    

    【讨论】: