TLDR:Is it possible to annotate the useNavigation hook in a generic component?
If I create a <BackButton />
component that uses the useNavigation()
hook is there a way to have it correctly type the hook when it is used in multiple screens?
The docs recommend typing this as:
const navigation = useNavigation<XScreenNavigationProp>();
However, this only works for when using useNavigation
in a specific screen. How does one annotate the hook for more than one screen?