首页 > 解决方案 > 模块 '"./node_modules/react-native"' 没有导出的成员 'View'

问题描述

在我用打字稿转换我的项目后,显示我遵循错误 模块'“./node_modules/react-native”'没有导出成员'视图'。

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

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

标签: javascripttypescriptreact-native

解决方案


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

推荐阅读