How to set iOS status bar background color in React Native?

后端 未结 6 1145
失恋的感觉
失恋的感觉 2020-11-28 18:43

Is there a single place in the react native iOS native code that I could modify to set iOS statusbar backgroundColor? RCTRootView.m ?

The react native StatusBar comp

6条回答
  •  迷失自我
    2020-11-28 18:58

    If you are using react-native-navigation, you need to:

    1-) Add this to your info.plist file:

    UIViewControllerBasedStatusBarAppearance
    YES
    

    2-) At first line of your render() function, eg:

      render(){
        this.props.navigator.setStyle({
          statusBarTextColorScheme: 'light'
        });
        return (
          
        );
      }
    

    This example will transform your status bar to light text/buttons/icons color.

提交回复
热议问题