简体   繁体   中英

React Native, React-Navigation

Can you help me on this problem:

Failed to compile /home/coding/Документы/React-native/instagram/node_modules/@react-navigation/stack/lib/module/views/Stack/CardStack.js Module not found: Can't resolve 'react-native-screens' in '/home/coding/Документы/React-native/instagram/node_modules/@react-navigation/stack/lib/module/views/Stack'

This is source code:

import { StatusBar } from "expo-status-bar";
import React from "react";

import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";

import LandingScreen from "./components/auth/Landing";

const Stack = createStackNavigator();
export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName="Landing">
        <Stack.Screen
          name="Landing"
          component={LandingScreen}
          options={{ headerShown: false }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

Based official docs of react-navigation you should install other related packages with the below command:

npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view

If you are using expo install these:

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM