I'm trying to use the navigation that comes from the @react-navigation/native library but it keeps showing this error:
No overhead matches this call.Overloading 1 of 2, '(...args: never): void', generated the following error.Argument of type 'string' is not assignable to parameter of type 'never'.The 2 of 2 overload, '(options: never): void', generated the following error.Argument of type 'string' is not assignable to parameter of type 'never'.ts(2769)
I've already solved the typing problem, now all that's missing is the navigation that doesn't change to the other component
import React from 'react';import { StatusBar, useWindowDimensions } from 'react-native';import LogoSvg from '../../assets/logo_background_gray.svg';import DoneSvg from '../../assets/done.svg';import { Container, Content, Footer, Mensage, Title } from './styles';import { ConfirmButton } from '../../components/ConfirmButton';import { useNavigation } from '@react-navigation/native';export function SchedulingComplete() { const { width } = useWindowDimensions(); const navigation = useNavigation(); function handleConfirm() { navigation.navigate('Home'); } return (<Container><StatusBar barStyle="light-content" translucent backgroundColor="transparent" /><LogoSvg width={width} /><Content><DoneSvg width={80} height={80} /><Title>Carro Alugado</Title><Mensage> Agora é só voce ir até{'\n'}a concessionária{'\n'}começar a dirigir</Mensage></Content><Footer><ConfirmButton title="OK" onPress={handleConfirm} /></Footer></Container> );}
And in de router is
import React from 'react';import { createNativeStackNavigator } from '@react-navigation/native-stack';import { Home } from '../screens/Home';import { Scheduling } from '../screens/Scheduling';import { SchedulingComplete } from '../screens/SchedulingComplete';import { SchedulingDetails } from '../screens/SchedulingDetails';import { CarDetails } from '../screens/CarDetails';const { Navigator, Screen } = createNativeStackNavigator();export function StackRoutes() { return (<Navigator screenOptions={{ headerShown: false }} initialRouteName="Home"><Screen name="Home" component={Home} /><Screen name="CarDetails" component={CarDetails} /><Screen name="Scheduling" component={Scheduling} /><Screen name="SchedulingDetails" component={SchedulingDetails} /><Screen name="SchedulingComplete" component={SchedulingComplete} /></Navigator> );}
github of this project is here