“依赖关系”:{ “@react-native-community/masked-view”:“0.1.10”, "@react-navigation/native": "^5.8.10", "@react-navigation/stack": "^5.12.8", "博览会": "^44.0.1", "expo-status-bar": "~1.2.0", “反应”:“^16.13.1”, “反应-dom”:“16.13.1”, "react-native": "^0.64.3", "react-native-gesture-handler": "~2.1.0", "react-native-paper": "^4.11.1", "react-native-reanimated": "~2.3.1", "react-native-safe-area-context": "3.3.2", "react-native-screens": "~3.10.1", "react-native-status-bar-height": "^2.6.0", “react-native-web”:“~0.13.12” },
React 17 引入了一个新功能
New JSX Transform
。简而言之,JSX Transform
可以让你写出react
而无需import React from 'react'
。不过,新功能是在 React 17 中引入的,并支持 React 16.14.0、React 15.7.0。 "react": "^16.13.1"
不兼容新功能,所以你应该升级你的react版本。
更新您的 React 版本可能可以解决您的问题。
命令行:
npm install --save react@latest
尝试删除所有这些文件:
然后运行:
npm start --reset-cache
最后:
npx react-native run-ios