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>
);
}
node_modules
foldernpm install @types/react @types/react-native
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.