声明不要妄想用swift作为壳子工程去集成rn,会出现很多头文件找不到并且解决方法很难搜出来!以下是用oc集成0.63版本的文件配置
1.集成中出现的问题
首先根据官方文档 新建package.json文件
添加react-native版本和添加react版本
目前用到版本
···
{
"name": "react-native-sc",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "yarn react-native start"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.9.3",
"antd-mobile": "^5.3.1",
"react": "^17.0.0",
"react-native": "0.63",
"react-native-elements": "^3.3.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.1",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.18.1",
"react-native-vector-icons": "^8.1.0"
}
}
xcode版本13.0
pod install 遇到问题 pod 文件是由cli生成新的工程后复制的
···
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'objc-construtor' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change false to true and then install pods
:hermes_enabled => true
)
解决 Xcode 12.5 troubleshooting guide (RN 0.61/0.62/0.63/0.64) #31480
https://github.com/facebook/react-native/issues/31480
use_flipper!({'Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1'})
解决 undefined method `react_native_post_install'
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end