官方文档地址: Integration with Existing Apps - React Native
中文文档:React Native 中文网
React-Native 开源App项目:GitHub - ReactNativeNews/React-Native-Apps: Curated List of Open Source React Native Apps
安卓按着官方文档基本没有问题,主要记录iOS遇到的问题,文档没有写,主要靠在 issue 里面搜索
react-native init 方式创建项目遇到的问题
问题描述:react-navtive run-ios 卡在 Running script 'Install Third Party'
- 原因:boost_1_63_0.tar.gz 下载失败
- 下载地址:Releases · react-native-community/boost-for-react-native · GitHub
- 把 boost_1_63_0.tar.gz 放入 ~/.rncache 文件夹,再次运行 react-navtive run-ios 即可
集成到已有iOS项目
问题描述 :‘fishhook/fishhook.h’ file not found
- 在package.json scripts 中添加
"fishhookinstall": "sed -i '' 's#<fishhook/fishhook.h>#\"fishhook.h\"#g' ./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m",
- 运行:
npm run fishhookinstall
- 返回 Podfile 目录
pod install
问题描述 :'RCTAnimation/RCTValueAnimatedNode.h' file not found
- 在package.json scripts 中添加
"nodeinstall": "sed -i '' 's\/#import <RCTAnimation\\/RCTValueAnimatedNode.h>\/#import \"RCTValueAnimatedNode.h\"\/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h",
- 运行:
npm run nodeinstall
- 返回 Podfile 目录
pod install
问题描述:"_JSNoBytecodeFileFormatVersion", referenced from:
- Add
BatchedBridge
React subspec in Podfile - 返回 Podfile 目录
pod install