error: Error: Unable to resolve module react-native-safe-area-context from C:\USER\App\NavigationApp\NavigationApp\node_modules\@react-navigation\stack\src\views\Stack\StackView.tsx: react-native-safe-area-context could not be found within the project.
我什么都没写,只是想学习React Navigation。我安装了@ react-navigation / native,以为现在可以开始了。但是,而不是JSX,我收到此错误:怎么办?
我的代码:
import React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
const App = () => {
return (
<View>
<Text>Hello</Text>
</View>
);
};
const styles = StyleSheet.create({
});
export default App;
react-native-navigation
软件包需要几个其他软件包才能工作,并且react-native-safe-area-context
是其中一部分,您只需要安装它$ npm i --save react-native-safe-area-context
在此处了解更多信息(https://reactnavigation.org/docs/getting-started/)快乐编码
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句