@react-sextant/upgrade-auto

React-Native 升级0.60+的自动更新脚步

Usage no npm install needed!

<script type="module">
  import reactSextantUpgradeAuto from 'https://cdn.skypack.dev/@react-sextant/upgrade-auto';
</script>

README

版本 升级指南
0.60+ 内置组件移除

如何使用?npm version

$ npm i @react-sextant/upgrade-auto

$ npm run upgrade-components

package.json变化⚠️

安装成功后 package.json将会被自动修改⚠️ 那些被移除的内置组件,需要在package.json中的upgradeDependencies字段中添加对应替换的npm包名

 {
   "name": "xxx",
   "version": "0.0.1",
   "scripts": {
     ...

+    "upgrade-components": "node node_modules/@react-sextant/upgrade-auto/upgrade-components.js"
   },

   ...

+  "upgradeDependencies": {
+    "NavigationActions": "@react-navigation/compat > react-navigation",
+    "ART": "import * as ART from '@react-native-community/art'",
+    "WebView": "react-native-webview",
+    "NetInfo": "@react-native-community/netinfo",
+    "CameraRoll": "@react-native-community/cameraroll",
+    "ImageEditor": "@react-native-community/image-editor",
+    "ViewPagerAndroid": "@react-native-community/viewpager"
+  }

 }

当React-Native版本升级时遇到了问题

常见问题1: 'WebView has been removed from React Native. It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " See https://github.com/react-native-community/react-native-webview',

移除了哪些组件?

https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#removed-3

第三方库不再维护怎么办?

  • fork+自己维护
  • 使用本脚步自动更新(适用于仅仅改个组件依赖方式)
    -  import {WebView, Button} from 'react-native'
    +  import {Button} from 'react-native'
    +  import {WebView} from 'react-native-native'