import { createNativeStackNavigator } from "@react-navigation/native-stack";
      
      type RootStackParamList = {
          Home: undefined;
          Checkout: undefined;
          Summary: undefined;
      };
      const RootStack = createNativeStackNavigator<RootStackParamList>();
      const NavStack = () => (
          <RootStack.Navigator initialRouteName="Home">
              <RootStack.Screen name={"Home"} component={HomeScreen} />
              <RootStack.Screen name={"Checkout"} component={CheckoutScreen} />
              <RootStack.Screen name={"Summary"} component={SummaryScreen} />
          </RootStack.Navigator>
      );
      
      Typescript language logo

      React Native Navigation Basic

      React Native Recipes

      This is a standard way to declare the RootStackParamList type and create a navigator component that routes the different screens in a react native app.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.