升级到React Native 0.26的问题

时间:2016-07-08 18:36:26

标签: react-native

我正处于绑定状态,因为应用程序在调试器可用之前失败,我不知道如何调试此问题。

enter image description here

这一切都是在我尝试升级到React Native 0.26时开始的(升级到0.29对于我们的代码库来说是一个巨大的变化设置,所以在多个步骤中执行此操作)。

我已按照文档从Component导入react,其余来自react-native

我已更新到最新的依赖项或至少模块支持0.26

但是我看到Module AppRegistry is not a registered callable module.并且我无法附加调试器(我希望我在这里弄错了)。我搜索了代码库,没有使用AppRegistry的组件。

这是package.json

{
  "name": "MyProjectName",
  "version": "1.2.0",
  "private": true,
  "dependencies": {
    "code-push": "^1.8.0-beta",
    "dateformat": "^1.0.12",
    "jasmine-core": "^2.4.1",
    "key-mirror": "^1.0.1",
    "numeral": "^1.5.3",
    "react": "15.0.2",
    "react-addons-update": "15.0.2",
    "react-mixin": "^3.0.3",
    "react-native": "^0.26.3",
    "react-native-code-push": "^1.10.0-beta",
    "react-native-collapsible": "^0.7.0",
    "react-native-custom-action-sheet": "0.0.11",
    "react-native-datetime": "0.1.2",
    "react-native-dismiss-keyboard": "^1.0.0",
    "react-native-drawer": "^2.2.6",
    "react-native-fabric": "0.0.2",
    "react-native-loading-spinner-overlay": "^0.1.1",
    "react-native-onesignal": "^1.1.5",
    "react-native-picker-android": "^1.0.2",
    "react-native-tab-navigator": "^0.3.2",
    "react-redux": "^4.4.0",
    "react-timer-mixin": "^0.13.3",
    "realm": "^0.14.1",
    "redux": "^3.5.2",
    "redux-logger": "^2.6.1",
    "validator": "^5.4.0"
  },
  "devDependencies": {}
}

这里是index.ios.js(Android版也完全相同)

'use strict';
import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    Navigator,
} from 'react-native';

import { Provider } from 'react-redux';
import configureStore from './lib/store/configureStore';

import App from './lib/app';

class MyProjectName extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        let store = configureStore({});
        return (
            <Provider store={store}>
                <App {...this.props}/>
            </Provider>
        );
    }

    componentWillMount() {

    }

    componentDidMount(){
       // const CodePush = require('react-native-code-push');
        // wait for 3 seconds otherwise rollback this change
       // CodePush.sync({ rollbackTimeout: 3000 });
    }

}

module.exports = MyProjectName;

有关如何解决此问题的任何提示?

1 个答案:

答案 0 :(得分:0)

node_modules中的模块仍然需要来自React的{​​{1}}时,我收到此消息。

我建议您浏览所有反应原生模块并寻找仍在使用的模块:

react-native

并将其替换为:

var React = require('react-native');

同样,import会对import React from 'react';

中的原生模块做出反应