How to hide React Native NavigationBar

后端 未结 11 1703
情书的邮戳
情书的邮戳 2020-12-30 02:25

I have NavigatorIOS under Navigator and would like to hide Navigator\'s NavigationBar to use NavigatorIOS\'s bar. Is there any way to do this?

This is screenshot tha

相关标签:
11条回答
  • 2020-12-30 02:44

    Because some old methods are deprecated i used stacknavigator. It works for me, if you are using StackNavigator.

    //******For Older Versions. But Will be Deprecated in future*******
    //static navigationOptions = { title: 'Welcome', header: null };
    
    //For Latest Version Use:
    static navigationOptions = { title: 'Welcome', headerShown: false};
    

    Feel free to contact, if any issue.

    0 讨论(0)
  • 2020-12-30 02:49
    static navigationOptions = { title: 'Welcome', header: null };
    
    0 讨论(0)
  • 2020-12-30 02:55

    If you use NavigatorIOS always, you can do it like this:

    1. modify the file NavigatorIOS.ios.js as below:

      before: navigationBarHidden={this.props.navigationBarHidden}
      after:  navigationBarHidden={route.navigationBarHidden}
      
    2. navigator.push({navigationBarHidden: false})

    0 讨论(0)
  • 2020-12-30 02:55

    use header: null for react-navigation, in your navigationOptions as follows;

    navigationOptions: {
        header: null,
    }
    
    0 讨论(0)
  • 2020-12-30 02:56

    you need declare navigation object like this .

    const StackNavigator = createStackNavigator(
      {
       Screen: { screen: HOME},
      },
      {
        navigationOptions: ({ navigation }) => {
          const { routeName } = navigation.state.routes[navigation.state.index];
          return {
            headerShown: false,
            header: null,
            headerTitle: routeName
          };
        }
      }
    );
    
    0 讨论(0)
提交回复
热议问题