After updating to react-navigation 6x when passing the navigation function it reports this error:
According to the documentation I need to type my createStackNavigation, I did, but it goes with an error. My route file:
import React from 'react';import { createStackNavigator } from '@react-navigation/stack';import { Home } from '../screens/Home';import { NewCall } from '../screens/NewCall';export type RootStackParamList = { Home: undefined; NewCall: undefined;};const { Navigator, Screen } = createStackNavigator<RootStackParamList>();export function AppStackRoutes() { return (<Navigator initialRouteName="Home" screenOptions={{ headerShown: false, }}><Screen name="Home" component={Home} /><Screen name="NewCall" component={NewCall} /></Navigator> )}
my navigation function:
const navigation = useNavigation();function handleNavigation() { navigation.navigate('NewCall');}