Given below is the example available in React Navigation documentation for Version 4.x
import { NavigationStackScreenComponent } from 'react-navigation-stack';
type Params = { userId: string };
type ScreenProps = { language: string };
const ProfileScreen: NavigationStackScreenComponent<
Params,
ScreenProps
> = props => {
// ...
};
ProfileScreen.navigationOptions = {
headerTitle: 'Profile',
};
I am still a noob in the typescript world but trying to adapt it to my React Native Projects.
The problem I am having is that NavigationStackScreenComponent
generic accepts types for navigation params and screenProps but there is no way (maybe there is but I couldn't find it!) for me to add type annotations for component props.