showing results for - "navigationoptions functional components"
Yusuf
03 Nov 2016
1I just tried this, but it doesn't seem to work for me:
2
3const HomeScreen = props => {
4    return <Text>Hello World</Text>
5}
6HomeScreen.navigationOptions = screenProps => ({
7    headerTitle: (props) => <Text>Start</Text>,
8})
9
10<NavigationContainer>
11  <Stack.Navigator>
12    <Stack.Screen name="Home" component={HomeScreen} />
13  </Stack.Navigator>
14</NavigationContainer>
15Instead of rendering "Start", it renders "Home". I'm using version 5.10.0
16
17EDIT: Not sure if this is just a hack or not, but it works for me...
18
19<Stack.Screen 
20  name="Home"
21  component={HomeScreen}
22  options={HomeScreen.navigationOptions} />
similar questions
queries leading to this page
navigationoptions functional components