I'm starting with React Native development and I encountered an issue in the very beginning. When trying to run my app I get errors:
Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
Unhandled JS Exception: Invariant Violation: Native module cannot be null.
Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
My App.js:
import React, { Component } from 'react';
import { SafeAreaView } from 'react-native';
import DefaultRouter from './src/navigation/DefaultRouter'
export default class App extends Component {
render() {
return (
<SafeAreaView>
<DefaultRouter />
</SafeAreaView>
);
}
};
index.js:
import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
DefaultRouter.js:
import { createSwitchNavigator, createAppContainer } from 'react-navigation';
import LoginScreen from '../screen/LoginScreen';
import DefaultTabBar from '../navigation/TabBar';
const DefaultRouter = createSwitchNavigator({
LOGIN_SCREEN: {
screen: LoginScreen
},
TAB_NAVIGATION: {
screen: DefaultTabBar
}
}, {
initialRouteName: 'LOGIN_SCREEN',
headerMode: 'none'
})
export default createAppContainer(DefaultRouter)
Other files are simple Component
subclasses.
The issue manifests regardless if I run the app from Visual Studio Code or from terminal with react-native run-ios
I looked through existing answers and I didn't find anything that could point me in the right direction:
React-Native: Module AppRegistry is not a registered callable module
React Native: Module AppRegistry is not a registered callable module (calling runApplication)
module appregistry is not a registered callable module (calling runApplication)Module AppRegistry is not a registered callable module and Cant find variable: Constants
React Native Module AppRegistry is not a registered callable module
Module AppRegistry is not a registered callable module only in Release configuration
I'm stuck and I don't know where to go from here