模块'"./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>
 );
}

回答

  1. 删除你的node_modules文件夹
  2. 在你的终端上运行这个 npm install @types/react @types/react-native
  3. 关闭编辑器并重新启动一切。

以上是模块'"./node_modules/react-native"'没有导出成员'View'的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>