React Native,反应导航
React Native, React-Navigation
你能帮我解决这个问题吗:
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'
这是源代码:
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>
);
}
基于official docs of react-navigation你应该使用以下命令安装其他相关包:
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
如果您使用的是 expo 安装这些:
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view
你能帮我解决这个问题吗:
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'
这是源代码:
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>
);
}
基于official docs of react-navigation你应该使用以下命令安装其他相关包:
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
如果您使用的是 expo 安装这些:
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view