简体   繁体   English

'react-native' 没有正确导入页面

[英]'react-native' not importing correctly to page

As you can see in the photo, there are 3 dots under react-native.正如您在照片中看到的,在 react-native 下有 3 个点。 On other projects when I hover over it it says as follows:在其他项目上,当我 hover 超过它时,它说如下:

module "/Users/mac/Library/Caches/typescript/4.5/node_modules/@types/react-native/index"模块“/Users/mac/Library/Caches/typescript/4.5/node_modules/@types/react-native/index”

But when I hover over in this new project, it says as follows:但是当我在这个新项目中 hover 结束时,它说如下:

module "/Users/mac/Desktop/project/rn-zoom/node_modules/react-native/index"模块“/Users/mac/Desktop/project/rn-zoom/node_modules/react-native/index”

I guess that's why when I type "Button", the automatic import option does not appear, or when I start typing props, the automatic import option does not appear.我想这就是为什么当我输入“Button”时,没有出现自动导入选项,或者当我开始输入道具时,没有出现自动导入选项。 What causes this situation and how can I fix it?是什么导致了这种情况,我该如何解决?

在此处输入图像描述

Install Plugins:安装插件:

React Native Tools & ES7 React/Redux/GraphQL/React-Native snippets React Native 工具和 ES7 React/Redux/GraphQL/React-Native 片段

Now check that at your bottom right corner the selected language is React.现在检查右下角选择的语言是 React。

delete your node-module folder and run npm install it will work for you.删除您的节点模块文件夹并运行npm install它将为您工作。 and also run the command of clear cache.并运行清除缓存的命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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