DEV Community

Discussion on: Using React Navigation with Functional Components

Collapse
 
corsal8 profile image
Corsal8

Hi! I'm not the OP, but I've made the header dynamic by passing to the Home.navigationOptions function the navigation parameter like so:

Home.navigationOptions = navigation => ({
  title: navigation.navigation.getParam('name', 'John Doe')
});

This should work based on the React Navigation doc (reactnavigation.org/docs/en/header...).

Last but not least, I'm completely new to React Native, so take my answer with a grain of salt :)

Collapse
 
kiwipedro profile image
kiwipedro

Thanks @corsal8 , not quite what I meant: if you look on the same react-native doc it's the setParam function I'm trying to use. Not sure of the syntax when using it in a functional component compared to the class component that the docs exemplify :)