Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade react-native to latest version

I am trying to upgrade to the latest version of react-native(react-native-0.26.2) so i can use react-native-flux-router.

I am getting this error: screenshoterror

The chrome console only shows default error messages.

Here is my package.json file

      "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"
  }

Here is output from adb logcat

logcat output

Steps taken to upgrade: Note* In order to get the current setup to work

"react-native": "0.25.1", "react": "0.14.5", "react-native-router-flux": "3.22.23"

I had to install this specific version of

"assert": "1.3.0"

. Reason is I was getting a buffer exception and after searching this is what I found solution to unknown module buffer

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.

like image 825
texas697 Avatar asked May 27 '16 11:05

texas697


1 Answers

With React Native 0.26 and higher, React itself is no longer bundled with React Native. This error seems to be caused by a propType definition where your or a third party component tries to use PropTypes.object.

You need to either update the offending component or change your own to access PropTypes directly from the react package like this:

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

class SomeComponent extends Component {
  static propTypes = {
    someProp: PropTypes.object
  };
}
like image 129
oblador Avatar answered Sep 20 '22 19:09

oblador