不变违规:模块AppRegistry不是已注册的可调用模块(调用unmountApplicationComponentAtRootTag)

时间:2020-11-05 06:45:06

标签: react-native

index.js

import {AppRegistry} from 'react-native';
import TabBar from './src/Navigation/TabBar';
import {name as appName} from './app.json';

import App from './App';

AppRegistry.registerComponent(appName, () => App);

App.js

import { Platform }                 from 'react-native';
//component cycle
import TabBar                       from './src/Navigation/TabBar'
//External Library
import SplashScreen                 from 'react-native-splash-screen'
import codePush from "react-native-code-push";
//For Redux
import { PersistGate }              from 'redux-persist/integration/react'
import { Provider }                 from 'react-redux'
import store, { persistor }         from './store'

class App extends Component {

    componentDidMount() {
        SplashScreen.hide();
    }

    componentWillMount() {
      codePush.disallowRestart();
    }

    render() {
        return (
          <Provider store={store}>
            <PersistGate loading={null} persistor={persistor}> 
                <TabBar />
            </PersistGate>
          </Provider>
        );
    }
    
}

所以请告诉我如何清除错误我已经从项目中清除了缓存,但是遇到了同样的错误

ERROR不变违规:模块AppRegistry不是已注册的可调用模块(正在调用 runApplication) 错误永久违反:模块AppRegistry不是已注册的可调用模块(调用unmountApplicationComponentAtRootTag)

1 个答案:

答案 0 :(得分:0)

您尚未使“应用”组件可导出

尝试此操作并添加“默认导出”

export default class App extends Component