skip to Main Content

I am a newbie at react-native and I am facing some issues in the react-native app, after installing ‘react-navigation’, everything is mentioned in the images. Hope you can help me. Have a good day.

App.js file

MainActivity.java

Package.json

Terminal-issue

Node-cli

2

Answers


  1. First: install @react-navigation/stack by
    npm install @react-navigation/stack
    using console(console must be opened in your project main directory).

    Choose one:

    1. If you are using bare React-Native project install react-gesture-handler using npm install react-native-gesture-handler.

    2. If you are using expo managed project(e.g you created project using npx expo init) – use
      npx expo install react-native-gesture-handler.

    Docs: https://reactnavigation.org/docs/stack-navigator/

    After successfull install please restart your metro/expo server.

    Login or Signup to reply.
  2. Use createNativeStackNavigator from native-stack instead.

    import * as React from 'react';
    import { View, Text } from 'react-native';
    import { NavigationContainer } from '@react-navigation/native';
    import { createNativeStackNavigator } from '@react-navigation/native-stack';
    
    ...
    
    const Stack = createNativeStackNavigator();
    
    function App() {
      return (
        <NavigationContainer>
          <Stack.Navigator>
    ...
          </Stack.Navigator>
        </NavigationContainer>
      );
    }
    
    export default App;
    

    See Installing the native stack navigator library for details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search