在React-native中,如何更改NavigatorIOS的样式

Mo *_*hen 12 ios react-native

在react-native中,如何更改NavigatorIOS的样式,例如backgroundColor?谢谢!

var speedNews = React.createClass({
  render: function() {
    return (
      <NavigatorIOS style={styles.container} 
      initialRoute={{ 
        title: 'SpeedNews',
        component: ViewList
      }}/>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor : 'red', // it do nothing
    color : '#ffffff' // it do nothing
  }
});
Run Code Online (Sandbox Code Playgroud)

Cry*_*fel 23

据我所知,您只能更改以下属性:

  • barTintColor:条形图背景的颜色.
  • titleTextColor:字体的颜色.
  • tintColor:按钮的颜色.
<NavigatorIOS
  barTintColor='#000'
  titleTextColor='#fff'
  tintColor='#fff'
  initialRoute={{
    title: 'SpeedNews',
    component: ViewList
  }} />
Run Code Online (Sandbox Code Playgroud)

  • @JoshPinter有一个StatusBar组件:<StatusBar barStyle ="light-content"/>.点击此处查看:https://facebook.github.io/react-native/docs/statusbar.html (2认同)

Mo *_*hen -3

也许我们可以使用“ react-native-router