小编Ami*_*lon的帖子

找不到模块:无法解析'@react-navigation/stack' React-Native

我试图设置一个 react-native 项目,在该项目中,我只尝试在 app.js 中使用包 react-navigation 创建堆栈导航器,我按照本指南https://reactnavigation.org/docs/getting-started然后进入https://reactnavigation.org/docs/hello-react-navigation但我收到错误

编译失败。D:/Visual Studio Code/Resturant Review/food/App.js Module not found: Can't resolve '@react-navigation/stack' in 'D:\Visual Studio Code\Resturant Review\food' 这是我的代码:

//app.js

import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}

const Stack = createStackNavigator();

function App() {
  return …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

2
推荐指数
1
解决办法
9482
查看次数

标签 统计

javascript ×1

react-native ×1

reactjs ×1