Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

How can I type check ReactNavigation's navigation using NavigationHelpersCommon?

$
0
0

I am new to the typescript screen, so the answer may be an obvious one. I am passing ReactNavigation's navigator as a prop to a functional component and I currently type check using navigator: object, but would love to use the typescript definition from ReactNavigation, so my code doesn't complain about things like "navigation.navigate" and so forth.

I found the type definition inside @react-navigation/core/lib/typescript/src/types.d.ts; however it is not exported.

I also found this in the ReactNavigation documentation, which indicates that I may be approaching this completely at the wrong angle.

https://reactnavigation.org/docs/typescript/#annotating-usenavigation

Or maybe I should find a way to use the useNavigation hook, but that would require me to use use component that wasn't a function like I prefer.

Bottomline: How can I import the NavigationHelpersCommon declaration to type check against?


Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>