I'm currently working on adding types to my TypeScript version of this function, but I'm facing some difficulties with it.
Perusing the React Navigation documentation:
// RootNavigation.js
import { createNavigationContainerRef } from '@react-navigation/native';
export const navigationRef = createNavigationContainerRef<RootStackParamList>()
export function navigate(name, params) {
if (navigationRef.isReady()) {
navigationRef.navigate(name, params);
}
}
// Include other necessary navigation functions and export them
I am using Typescript and trying to define types for the params in navigate(name, params)
, but I'm unsure about the correct approach. Any insights on this?
I've already added typing for the container as shown below:
export const navigationRef = createNavigationContainerRef<RootStackParamList>()