在Expo React Native应用程序中,执行react-native link
后执行yarn add react-navigation native-base
时发生以下错误。
添加React Navigation和Native-Base时显示的警告
warning “expo > react-native-maps@0.21.0” has incorrect peer dependency “react-native@^0.51 || ^0.52 || ^0.53 || ^0.54”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react@16.0.0-alpha.6”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react-native@^0.44.1”.
warning " > react-native@0.55.4" has incorrect peer dependency “react@16.3.1”.
warning “react-native > eslint-plugin-react-native@3.2.1” has unmet peer dependency “eslint@^3.17.0 || ^4.0.0”.
warning “react-navigation > create-react-context@0.2.2” has unmet peer dependency “prop-types@^15.0.0”.
执行react-native链接时遇到错误
PS C:\Projects\proj> react-native link
Scanning folders for symlinks in C:\Projects\proj\node_modules (81ms)
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property ‘pbxprojPath’ of null
Please file an issue here: https://github.com/facebook/react-native/issues
答案 0 :(得分:5)
react-native link
命令适用于使用react-native init
命令创建的反应本机项目,以链接本机依赖项。您可以详细了解here。
如果您的项目是使用create-react-native-app
或使用expo创建的,请按照this (带有CRNA的安装程序)安装过程将Native Base添加到您的项目中。 react-navigation
是纯JS库,不需要任何本地链接。
使用CRNA CLI创建React Native项目。
CRNA可帮助您制作没有构建配置的React Native应用。 CRNA可在macOS,Windows和Linux上运行。
yarn add native-base --save npm install @expo/vector-icons --save