2017-11-18 120 views
2

我面临这个错误,并试图从互联网研究,但没有运气。 它只是突然发生没有理由,所以我不知道如何重现该错误。 我跟着这个解决方案(https://github.com/facebook/react/issues/8454)试图卸载,重新安装,但仍然反应JS一样。 谁能帮看看这个? 非常感谢。 这是我的package.json未定义不是一个函数(评估'ReactComponentTreeHook.purgeUnmountedComponents()'

{ 
    "name": "AwesomeLeadership", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "test": "jest" 
    }, 
    "dependencies": { 
    "@monterosa/react-native-parallax-scroll": "^1.0.4", 
    "create-react-class": "^15.6.2", 
    "dateformat": "^2.0.0", 
    "k-core": "0.0.1-alpha.2", 
    "lodash-node": "^3.10.2", 
    "native-base": "^2.3.1", 
    "prop-types": "^15.6.0", 
    "pusher-js": "^4.0.0", 
    "react": "^16.1.1", 
    "react-debbuger": "0.0.1", 
    "react-native": "^0.47.1", 
    "react-native-autogrow-textinput": "^4.0.0", 
    "react-native-autolink": "^1.1.1", 
    "react-native-confetti": "0.0.6", 
    "react-native-console-panel": "^0.1.0", 
    "react-native-deprecated-custom-components": "^0.1.1", 
    "react-native-drawer": "^2.3.0", 
    "react-native-drop-refresh": "^2.2.0", 
    "react-native-dropdown-menu": "^1.1.0", 
    "react-native-easy-grid": "^0.1.15", 
    "react-native-easy-toast": "^1.0.6", 
    "react-native-i18n": "^2.0.1", 
    "react-native-image-picker": "^0.25.1", 
    "react-native-keyboard-aware-scroll-view": "^0.3.0", 
    "react-native-keyboard-aware-scrollview": "^1.1.7", 
    "react-native-keyboard-manager": "^4.0.10-3", 
    "react-native-keyboard-spacer": "^0.4.1", 
    "react-native-lightbox": "^0.7.0", 
    "react-native-loading-spinner-overlay": "^0.5.2", 
    "react-native-media-kit": "git+https://github.com/ldn0x7dc/react-native-media-kit.git#pull/30/head", 
    "react-native-modal": "^3.0.2", 
    "react-native-modal-datetime-picker": "^4.7.0", 
    "react-native-modal-dropdown": "^0.4.4", 
    "react-native-modal-wrapper": "^2.3.0", 
    "react-native-mov-to-mp4": "^0.2.1", 
    "react-native-multiple-select": "^0.2.1", 
    "react-native-native-video-player": "^1.3.4", 
    "react-native-orientation": "git+https://[email protected]/yamill/react-native-orientation.git", 
    "react-native-photo-view": "^1.3.0", 
    "react-native-progress": "^3.3.0", 
    "react-native-progress-bar-classic": "^1.2.1", 
    "react-native-push-notification": "^2.2.1", 
    "react-native-scrollable-tab-view": "^0.8.0", 
    "react-native-simple-modal": "^6.0.0", 
    "react-native-slider": "^0.10.0", 
    "react-native-spinkit": "^1.1.1", 
    "react-native-star-rating": "^1.0.7", 
    "react-native-swiper": "^1.5.4", 
    "react-native-textinput-effects": "^0.4.1", 
    "react-native-thumbnail": "^1.0.8", 
    "react-native-triangle": "0.0.9", 
    "react-native-vector-icons": "^4.0.0", 
    "react-native-video": "^2.0.0", 
    "react-redux": "^4.4.5", 
    "redux": "^3.6.0", 
    "redux-logger": "^2.7.4", 
    "redux-persist": "^4.0.1", 
    "redux-thunk": "^2.1.0", 
    "underscore": "^1.8.3" 
    }, 
    "jest": { 
    "preset": "jest-react-native" 
    }, 
    "devDependencies": { 
    "babel-eslint": "^7.1.1", 
    "babel-jest": "17.0.0", 
    "babel-preset-react-native": "1.9.0", 
    "eslint": "^3.11.1", 
    "eslint-config-airbnb": "^13.0.0", 
    "eslint-plugin-import": "^2.2.0", 
    "eslint-plugin-jsx-a11y": "^2.2.3", 
    "eslint-plugin-react": "^6.7.1", 
    "jest": "^17.0.0", 
    "jest-react-native": "17.0.0", 
    "react-test-renderer": "15.3.2" 
    }, 
    "rnpm": { 
    "assets": [ 
     "./assets/fonts" 
    ] 
    } 
} 

index.android.js

import React, { AppRegistry } from 'react-native'; 
import AppProvider from './src/index'; 
AppRegistry.registerComponent('AwesomeLeadership',() => AppProvider); 

index.js

import React, { Component } from 'react'; 
import { AppRegistry } from 'react-native'; 
import { Provider } from 'react-redux'; 
import { persistStore, autoRehydrate } from 'redux-persist'; 
import store from './app/appStore'; 
import AppContainer from './app/appContainer'; 
import Splashscreen from './app/splashScreen'; 
import I18n from './app/i18n'; 
import SwipUnlocker from './app/SwipeUnlocker'; 

const Orientation = require('react-native-orientation'); 

class AwesomeLeadership extends Component { 
    render() { 
    return <AppContainer /> ; 
    } 
} 

class AppProvider extends Component { 
    constructor(props) { 
    super(props); 
    this.state = { 
     isInitializing: true, 
    } 
    } 

    componentDidMount() { 
    Orientation.lockToPortrait(); 
    const unsubscribe = store.subscribe(() => { 
     if (store.getState().isHydrated) { 
     unsubscribe(); 
     I18n.locale = 'sv-SE'; 
     this.setState({ 
      isInitializing: false, 
     }); 
     } 
    }); 
    } 

    render() { 
    if(this.state.isInitializing) { 
     return <Splashscreen/>; 
    } else { 
     return (
     <Provider store={store}> 
      <AwesomeLeadership/> 
     </Provider> 
    ); 
    } 
    } 
} 

export default AppProvider; 

enter image description here

+0

为了得到最好的建议,尽量添加尽可能多的细节,并避免添加健谈的材料。在这个问题中所有的正文都是不相关的:你被卡住了多长时间,你已经“Google搜索”,你仍然无法修复它,并且你希望人们看到它是明显的或不相关的。但是我们不知道哪个代码产生了这个错误,这也许是所有最关键的细节。你做了什么来产生错误?读者如何重现它?你会更新这篇文章吗? – halfer

回答

0

我面临着同样的错误......我 只是改变反应原生版本0.49.0。工作正常。

+1

这不提供问题的答案。一旦你有足够的[声誉](https://stackoverflow.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提问者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [来自评论](/ review/low-quality-posts/17996987) – snakecharmerb

1

我有同样的错误,我相信它与不同版本的React和React Native连接。

例如,RN 0.51需要React 16.0的对等体依赖。在我的情况下,我有16个字母,并导致了错误。我建议你尝试安装相应版本的React。

希望它有帮助。

相关问题