Hi I'm trying TS in react native for first time and I am getting errors from typescript when I try to use navigation.navigate() function.This is my Navigator.tsx
import { createNativeStackNavigator, NativeStackScreenProps } from "@react-navigation/native-stack";import HomeScreen from "../Screens/HomeScreen";import SecondScreen from "../Screens/SecondScreen";import { useSelector } from "react-redux";import PhoneEntry from "../Screens/Auth/PhoneEntry";import PhoneVerification from "../Screens/Auth/PhoneVerification";import { CountryListDataProps } from "../components/CountryCodeModal";import { FirebaseAuthTypes } from "@react-native-firebase/auth";import ConfirmationResult = FirebaseAuthTypes;export type RootStackParamList = {"Home": undefined;"Login": undefined;"PhoneEntry":undefined;"PhoneVerification":{phoneNumber:string, selectedCountry:Partial<CountryListDataProps>,verification:ConfirmationResult}};const Stack = createNativeStackNavigator<RootStackParamList>();const CustomStackNavigator = () => { const auth = useSelector((state) => state.auth.isLoggedIn); return (<Stack.Navigator initialRouteName={"Home"} screenOptions={{ headerShown: false }}><Stack.Screen name="Home" component={auth?SecondScreen:HomeScreen} /><Stack.Screen name="PhoneEntry" component={PhoneEntry}/><Stack.Screen name="Login" component={SecondScreen} /><Stack.Screen name="PhoneVerification" component={PhoneVerification} /></Stack.Navigator> );};export type PhoneVerificationType = NativeStackScreenProps<RootStackParamList,"PhoneVerification">export type PhoneEntryType = NativeStackScreenProps<RootStackParamList,"PhoneEntry">export type HomeType = NativeStackScreenProps<RootStackParamList,"Home">export default CustomStackNavigator;In my PhoneVerification.tsx I have my component like this:
function PhoneVerification({navigation,route}:PhoneVerificationType)similarly in other components as well. However when I try to use navigation.navigate("PhoneVerification"{myPropsHere}) in any screen. Typescript is showing error
Argument type "PhoneVerification" is not assignable to parameter typeany
Argument type {selectedCountry: CountryListDataProps, phoneNumber:string, verification: ConfirmationResult} is not assignable toparameter type any
I've checked other solutions on stackoverflow, but nothing worked for me.






