1. 创建一个指定版本的RN项目
react-native init RN63 --version 0.63.4
如果:现有的RN项目引用了很多三方库,执行完上面操作后有两种方式来
将现有RN项目的package.json里的依赖copy到 RN63的package.json 然后执行 npm install
2.修改pod引用方式
将 pod xxx, :path => 修改为 pod xxx, :podspec =>
- 1.修改node_modules/@react-native-community/cli-platform-ios/native_module文件里的
pod spec.name, :path => relative_path.to_path
to:
pod spec.name, :podspec => relative_path.to_path
- 2.修改node_modules/react-native/scripts/react_native_pods文件里的
pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
to:
pod 'FBLazyVector', :podspec => "#{prefix}/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "#{prefix}/Libraries/FBReactNativeSpec"
to:
pod 'FBReactNativeSpec', :podspec => "#{prefix}/Libraries/FBReactNativeSpec"
...
...
react_native_pods
3.!!!修改native_module中的所有用到的podspec文件
以 pod 'FBLazyVector', :podspec => "#{prefix}/Libraries/FBLazyVector" 为例
在/Libraries/FBLazyVector目录下找到FBLazyVector.podspec
s.source_files = "**/*.{c,h,m,mm,cpp}"
to:
s.source_files = "Libraries/FBLazyVector/**/*.{c,h,m,mm,cpp}"
TIPS:
{prefix}/Libraries/FBLazyVector 看成 {prefix}/XXX
则对应修改
s.source_files = "XXX/**/*.{c,h,m,mm,cpp}"
注意
!!!!!
修改 React-RCTBlob 时,
s.source_files = "*.{m,mm}"
to:
s.source_files = "Libraries/Blob/*.{h,m,mm}"
注销掉修改过的podspec文件里的 s.preserve_paths
# s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
网友评论