模块'"./node_modules/react-native"'没有导出成员'View'
在我在打字稿中转换我的项目后,显示了以下错误
模块 '"./node_modules/react-native"' 没有导出成员 '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文件夹 - 在你的终端上运行这个
npm install @types/react @types/react-native - 关闭编辑器并重新启动一切。
THE END
二维码