最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Module '".node_modulesreact-native"' has no exported member 'View&#39

programmeradmin3浏览0评论

After i convert my project in typescript showing me following error Module '"./node_modules/react-native"' has no exported member 'View'.

import React from 'react';
import {StyleSheet,View,Text} from 'react-native';

export default function App() {
return (
  <View style={{ flex: 1 }}>
    <Text>Welcome</Text>
  </View>
 );
}

After i convert my project in typescript showing me following error Module '"./node_modules/react-native"' has no exported member 'View'.

import React from 'react';
import {StyleSheet,View,Text} from 'react-native';

export default function App() {
return (
  <View style={{ flex: 1 }}>
    <Text>Welcome</Text>
  </View>
 );
}
Share Improve this question asked Jan 27, 2021 at 7:04 javedjaved 4164 silver badges11 bronze badges 1
  • 2 remove the nodemodules folder and do npm install again – prasanth Commented Jan 27, 2021 at 7:27
Add a comment  | 

3 Answers 3

Reset to default 15
  1. Delete your node_modules folder
  2. run this on your terminal npm install @types/react @types/react-native
  3. close the editor and restart everything.

Delete node_modules folder and run npm install or yarn again.

If it not solve this problem, try to run npm install @types/react @types/react-native or yarn add @types/react @types/react-native

Probably you should also use -D option to install it as a development dependency, which adds it to the devDependencies list.

npm install --save-dev @types/react @types/react-native
(npm install -D @types/react @types/react-native)

or

yarn add --dev @types/react @types/react-native
(yarn add -D @types/react @types/react-native)
发布评论

评论列表(0)

  1. 暂无评论