Ad

How To Set Up Title Of Scene Component In React-native-router-flux

I have normal Scene component of react-native-router-flux. I want to set up title of Scene. How can I set up title's properties.

For example I want backgroundColor of title :"red", alignItems:"center" like this.

return (
    <Router>
      <Scene key="root">
        <Scene key="login"
          component={LoginForm}
          title="Login"
        />
      </Scene>
    </Router>
)
Ad

Answer

Try adding the prop titleStyle like this way:

const styles = StyleSheet.create({
    navigationBarTitleStyle: {
        backgroundColor: 'green',
    }
});

return (
    <Router>
      <Scene key="root">
        <Scene key="login"
          component={LoginForm}
          title="Login"
          titleStyle={styles.navigationBarTitleStyle}
        />
      </Scene>
    </Router>
)
Ad
source: stackoverflow.com
Ad