I cannot see the title in my header:
const withHeader = (
screen: Function,
routeName: string,
Header
): StackNavigator =>
createStackNavigator({
[routeName]: {
screen,
navigationOptions: ({ navigation, routeName }) => ({
header: props => <Header {...props} />,
title: routeName,
headerMode: "screen",
layoutPreset: "right"
})
}
});
this.props
doesnt contain the title prop.
How can I pass the title to my header?
You can use static navigationOptions
in you Class/Screen:
class TargetScreen extends React.Component {
static navigationOptions = {
title: 'Your Title',
};
/* render function, etc */
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.