2016-05-27 55 views
5

我正在嘗試升級到react-native(react-native-0.26.2)的最新版本,所以我可以使用react-native-flux-router。如何將react-native升級到最新版本

我收到此錯誤: screenshoterror

鉻控制檯只顯示默認的錯誤消息。

這裏是我的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" 
    } 

下面是來自亞行logcat輸出

logcat output

採取

升級步驟: 注*爲了得到當前的設置工作我們不得不安裝l此特定版本

"assert": "1.3.0"

。原因是我得到一個緩衝區異常和搜索後,這是我發現solution to unknown module buffer

當我試圖升級時,我得到了最新版本的反應,本機和反應。然後我降級反應的版本眼見反應本土警告消息後,要求

"react": "15.0.2"

然後我刪除了斷言包。我嘗試了一切從卸載應用程序和重新編譯,我試圖重新啓動計算機和手機。我發現的唯一的東西是這search result

所以我甚至安裝了全球最新版本的巴貝爾,但不確定它做了什麼。然後我也確定我在所有視圖中都有構造函數中的東西。

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

我不確定接下來要做什麼,因爲控制檯中沒有有用的錯誤。

+0

你可以列出你在升級過程中迄今所採取的步驟是什麼? –

+1

當然。將在電腦前大約一小時 – texas697

+0

請參閱更新請 – texas697

回答

5

對於React Native 0.26及更高版本,React本身不再與React Native捆綁在一起。此錯誤似乎是由propType定義造成的,您的或第三方組件嘗試使用PropTypes.object

您需要更新該問題的組件或更改自己直接從react包這樣的訪問PropTypes

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

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

如果您有大量文件,有一個腳本可以幫助您。看看[這裏](https://github.com/sibeliusseraphini/codemod-RN24-to-RN25)! –