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

Identifying types in react navigation navigationRef

$
0
0

I am trying to add types to my TS version of this function, and am having a bit of trouble.

From the React Navigation docs:

// RootNavigation.jsimport { createNavigationContainerRef } from '@react-navigation/native';export const navigationRef = createNavigationContainerRef()export function navigate(name, params) {  if (navigationRef.isReady()) {    navigationRef.navigate(name, params);  }}// add other navigation functions that you need and export them

I am using Typescript and want to add types to the params navigate(name, params) but I can't quite figure out what they should be. Any thoughts?

I already have the container typed like so:

export const navigationRef = createNavigationContainerRef<RootStackParamList>()


Viewing all articles
Browse latest Browse all 6290

Trending Articles



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