I'm using typescript in my react-native project(expo).
The project uses react-navigation, so on my screens I can set navigationOptions
and I have access to the prop navigation
.
Now I'm trying to strongly type these so I get hints for what properties are available to set.
interface NavStateParams { someValue: string}interface Props extends NavigationScreenProps<NavStateParams> { color: string}class Screen extends React.Component<Props, any> { // This works fine static navigationOptions: NavigationStackScreenOptions = { title: 'ScreenTitle' } // Does not work static navigationOptions: NavigationStackScreenOptions = ({navigation, screenProps }) => ({ title: navigation.state.params.someValue })}
What would be the best way to handle react-navigation as props for components.