mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	Update guide
This commit is contained in:
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @@ -2,18 +2,6 @@ | |||||||
|  |  | ||||||
| 本组件是面向 React Native 提供热更新功能的组件,建议结合[Update 服务](https://update.reactnative.cn/)使用。 | 本组件是面向 React Native 提供热更新功能的组件,建议结合[Update 服务](https://update.reactnative.cn/)使用。 | ||||||
|  |  | ||||||
| ### 版本 |  | ||||||
|  |  | ||||||
| 因为 React Native 不同版本代码结构不同,因而请按下面表格对号入座: |  | ||||||
|  |  | ||||||
| | React Native 版本 | react-native-update 版本 | |  | ||||||
| | ----------------- | ------------------------ | |  | ||||||
| | 0.26 及以下       | 1.0.x                    | |  | ||||||
| | 0.27 - 0.28       | 2.x                      | |  | ||||||
| | 0.29 - 0.33       | 3.x                      | |  | ||||||
| | 0.34 - 0.45       | 4.x                      | |  | ||||||
| | 0.46 及以上       | 5.x                      | |  | ||||||
|  |  | ||||||
| ### 优势 | ### 优势 | ||||||
|  |  | ||||||
| 1. 命令行工具&网页双端管理,版本发布过程简单便捷,完全可以集成 CI。 | 1. 命令行工具&网页双端管理,版本发布过程简单便捷,完全可以集成 CI。 | ||||||
|   | |||||||
| @@ -6,8 +6,6 @@ | |||||||
|  |  | ||||||
| 所以我们也假设你已经拥有了开发React Native应用的一切环境,包括`Node.js`、`npm`、`XCode`、`Android SDK`等等。 | 所以我们也假设你已经拥有了开发React Native应用的一切环境,包括`Node.js`、`npm`、`XCode`、`Android SDK`等等。 | ||||||
|  |  | ||||||
| 如果React Native的版本是0.45以下,并且你之前没安装过,你还必须安装[Android NDK](http://androiddevtools.cn),版本最好选用r10e,并设置环境变量`ANDROID_NDK_HOME`,指向你的NDK根目录(例如`/Users/tdzl2003/Downloads/android-ndk-r10e`)。0.46以上的React Native不需要安装NDK。 |  | ||||||
|  |  | ||||||
| ## 安装 | ## 安装 | ||||||
|  |  | ||||||
| 在你的项目根目录下运行以下命令: | 在你的项目根目录下运行以下命令: | ||||||
| @@ -25,13 +23,15 @@ npm i react-native-update | |||||||
| pod install | pod install | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| 如果你的RN版本 < 0.60,那么还需要[手动link](#一、手动link) | 如果你的RN版本 < 0.60,那么还需要[手动link](#一手动link) | ||||||
|  |  | ||||||
| 请记得一定要重新编译(react-native run-ios或run-android命令编译,或在Xcode/Android Studio中重新编译)。 |  | ||||||
|  |  | ||||||
| ### 版本 | <details> | ||||||
|  | <summary> | ||||||
|  | 如果你的RN版本比较老(< 0.46),请点击这里的注意事项 | ||||||
|  | </summary> | ||||||
|  |  | ||||||
| 因为React Native不同版本代码结构不同,因而请按下面表格对号入座: | 如果你的RN版本比较老,请按下面表格尝试老一些的版本(但这些版本我们已不再维护,不能保证可以使用): | ||||||
|  |  | ||||||
| | React Native版本 | react-native-update版本 | | | React Native版本 | react-native-update版本 | | ||||||
| | ---------------- | ----------------------- | | | ---------------- | ----------------------- | | ||||||
| @@ -39,21 +39,26 @@ pod install | |||||||
| | 0.27 - 0.28      | 2.x                     | | | 0.27 - 0.28      | 2.x                     | | ||||||
| | 0.29 - 0.33      | 3.x                     | | | 0.29 - 0.33      | 3.x                     | | ||||||
| | 0.34 - 0.45      | 4.x                     | | | 0.34 - 0.45      | 4.x                     | | ||||||
| | 0.46及以上       | 5.x                     | |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 安装命令示例: | 安装命令示例: | ||||||
| ``` | ``` | ||||||
| npm i react-native-update@5.x | npm i react-native-update@4.x | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | 如果RN的版本是0.45及以下,你还必须安装[Android NDK](http://androiddevtools.cn),版本最好选用r10e,并设置环境变量`ANDROID_NDK_HOME`,指向你的NDK根目录(例如`/Users/tdzl2003/Downloads/android-ndk-r10e`)。 | ||||||
|  | </details> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 请记得一定要重新编译(react-native run-ios或run-android命令编译,或在Xcode/Android Studio中重新编译)。 | ||||||
|  |  | ||||||
|  |  | ||||||
| ## 一、手动link | ## 一、手动link | ||||||
|  |  | ||||||
| 如果RN版本 >= 0.60则可以跳过此步骤 | 如果RN版本 >= 0.60则可以跳过此步骤 | ||||||
|  |  | ||||||
| ### iOS | ### iOS | ||||||
|  |  | ||||||
| <detail> | <details> | ||||||
| <summary>RN < 0.60且使用CocoaPods(推荐)</summary> | <summary>RN < 0.60且使用CocoaPods(推荐)</summary> | ||||||
|  |  | ||||||
| 1. 在ios/Podfile中添加 | 1. 在ios/Podfile中添加 | ||||||
| @@ -63,9 +68,9 @@ pod 'react-native-update', path: '../node_modules/react-native-update' | |||||||
| 2. 在项目的ios目录下运行`pod install` | 2. 在项目的ios目录下运行`pod install` | ||||||
| 3. 重新编译 | 3. 重新编译 | ||||||
|     |     | ||||||
| </detail> | </details> | ||||||
|  |  | ||||||
| <detail> | <details> | ||||||
| <summary>RN < 0.60且不使用CocoaPods</summary> | <summary>RN < 0.60且不使用CocoaPods</summary> | ||||||
|  |  | ||||||
| 1. 在XCode中的Project Navigator里,右键点击`Libraries` ➜ `Add Files to [你的工程名]` | 1. 在XCode中的Project Navigator里,右键点击`Libraries` ➜ `Add Files to [你的工程名]` | ||||||
| @@ -74,7 +79,7 @@ pod 'react-native-update', path: '../node_modules/react-native-update' | |||||||
| 4. 继续在`Build Settings`里搜索`Header Search Path`,添加$(SRCROOT)/../node_modules/react-native-update/ios | 4. 继续在`Build Settings`里搜索`Header Search Path`,添加$(SRCROOT)/../node_modules/react-native-update/ios | ||||||
| 5. 重新编译 | 5. 重新编译 | ||||||
|  |  | ||||||
| </detail> | </details> | ||||||
|  |  | ||||||
| ### Android | ### Android | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm