react-navigation套件

https://reactnavigation.org/docs/en/navigating.html

1.隱藏Header,於各router 的 component

class .....
  static navigationOptions = {
    header: null,
  };
  .....
}

https://stackoverflow.com/questions/44701245/hide-header-in-stack-navigator-react-navigation

v5:

 <Stack.Navigator
     screenOptions={{
       headerShown: false,
     }}
 ...

2.進行導航

使用this.props.navigation.navigate('Main')

使用createStackNavigator來初始化該路由,然後用createBottomTabNavigator建立底部導航

v5:

範例:

https://snack.expo.io/@react-navigation/going-back-v2

監聽Router Change

react-navigation listen on router change

1.

使用NavigationEvents即可。

Last updated

Was this helpful?