如何将React-Native升级到最新版本

德州697

我正在尝试升级到最新版本的react-native(react-native-0.26.2),因此我可以使用react-native-flux-router。

我收到此错误: 屏幕截图错误

chrome控制台仅显示默认错误消息。

这是我的package.json文件

      "dependencies": {
    "@remobile/react-native-splashscreen": "^1.0.3",
    "firebase": "^3.0.3",
    "jwt-decode": "^2.0.1",
    "moment": "^2.12.0",
    "node-uuid": "^1.4.7",
    "q": "^1.4.1",
    "react": "15.0.2",
    "react-native": "0.26.2",
    "react-native-action-button": "^1.1.4",
    "react-native-android-statusbar": "^0.1.2",
    "react-native-animatable": "^0.6.0",
    "react-native-button": "^1.5.0",
    "react-native-device-info": "^0.9.3",
    "react-native-drawer": "^2.2.3",
    "react-native-file-uploader": "0.0.2",
    "react-native-gifted-spinner": "0.0.4",
    "react-native-image-picker": "^0.18.17",
    "react-native-keep-screen-on": "^1.0.3",
    "react-native-maps": "^0.4.2",
    "react-native-modalbox": "^1.3.3",
    "react-native-orientation": "^1.16.0",
    "react-native-router-flux": "^3.26.5",
    "react-native-simple-store": "^1.0.1",
    "react-native-vector-icons": "^2.0.2",
    "react-timer-mixin": "^0.13.3",
    "underscore": "^1.8.3"
  },
  "devDependencies": {
    "eslint": "2.10.2",
    "eslint-plugin-react": "5.1.1",
    "eslint-plugin-react-native": "1.1.0-beta"
  }

这是adb logcat的输出

logcat输出

升级步骤:注意*为了使当前设置生效

“ react-native”:“ 0.25.1”,“ react”:“ 0.14.5”,“ react-native-router-flux”:“ 3.22.23”

我必须安装此特定版本的

“ assert”:“ 1.3.0”

原因是我遇到了缓冲区异常,搜索后发现了未知模块缓冲区的解决方案

When I tried to upgrade I got the latest version of react-native and react. I then downgraded the version of react after seeing the warning message that react-native requires

"react": "15.0.2"

I then removed the assert package. I tried everything from uninstalling the app and re-compiling, I tried rebooting both the computer and the phone. The only thing I found from searching is this search result

So I even installed the latest version of babel globally, not sure that did much of anything though. I then also made sure I had something in the constructor in all the views.

 export default class Home extends Component {
    constructor(props) {
        super(props);
        this.state = {
            foo: 'bar'
        }
    }

I am not sure what to do next because there is no useful errors in the console.

oblador

在React Native 0.26和更高版本中,React本身不再与React Native捆绑在一起。此错误似乎是由propType您或第三方组件尝试使用定义引起的PropTypes.object

您需要更新有问题的组件或更改您自己的组件,以PropTypes直接从react包中进行访问如下所示:

import React, { Component, PropTypes } from 'react';

class SomeComponent extends Component {
  static propTypes = {
    someProp: PropTypes.object
  };
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章