Reputation: 706
Consider the following code:
'Points of Interest': {
screen: Views.POI,
navigationOptions: ({ navigation }) => ({
headerTitle: 'Interesting Places',
}),
},
However, if I were to add a view of any kind, say, a button, to headerRight like:
'Points of Interest': {
screen: Views.POI,
navigationOptions: ({ navigation }) => ({
headerTitle: 'Interesting Places',
headerRight: <BackButton navigation={navigation} screen={'Points of Interest'} />,
}),
},
What am I missing out here?
Upvotes: 1
Views: 368
Reputation: 281686
You can make use of headerTitleAlign
to set the left value to headerTitle
'Points of Interest': {
screen: Views.POI,
navigationOptions: ({ navigation }) => ({
headerTitle: 'Interesting Places',
headerRight: <BackButton navigation={navigation} screen={'Points of Interest'} />,
headerTitleAlign: 'left'
}),
},
You can make use of headerRightContainerStyle
to add further stylings to headerRight
Upvotes: 0
Reputation: 2104
Like me I will set backButton in headerLeft and title in center
'Points of Interest': {
screen: Views.POI,
navigationOptions: ({ navigation }) => ({
headerTitle: 'Interesting Places',
headerLeft: <BackButton navigation={navigation} screen={'Points of Interest'} />,
headerTitleAlign: 'center', // align center in android
}),
},
Upvotes: 1