I am using an expo managed react-native project and it seems to be running fine on android but not iOS. For iOs i get the following error message :
"'main' has not been registered. This can happen if: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
- A module failed to load due to an error and 'AppRegistry.registerComponent' wasn't called."
I have tried updating my index.js using AppRegistry.registerComponent('main', () => App) from similar posts but to no avail. What am I doing wrong?
index.js
import { registerRootComponent } from "expo";
import App from "./App";
// registerRootComponent calls AppRegistry.registerComponent('main', ()
=> App);
// It also ensures that whether you load the app in the Expo client or in
a native build,
// the environment is set up appropriately
registerRootComponent(App);
App.js
import "react-native-gesture-handler";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import React from "react";
import { StyleSheet } from "react-native";
import { ScreenStack } from "react-native-screens";
import Login from "./Login";
import Join from "./Join";
import Home from "./Home";
import Dashboard from "./Dashboard";
import BorrowMap from "./BorrowMap";
import SpotRequest from "./SpotRequest";
// import { registerRootComponent } from "expo";
const Stack = createStackNavigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Home"
component={Home}
options={{ title: "Welcome" }}
/>
<Stack.Screen
name="Login"
component={Login}
options={{ title: "Login" }}
/>
<Stack.Screen
name="Join"
component={Join}
options={{ title: "Register" }}
/>
<Stack.Screen
name="Dashboard"
component={Dashboard}
options={{ title: "Dashboard" }}
/>
<Stack.Screen
name="Spot Request"
component={SpotRequest}
options={{ title: "Spot Request Details" }}
/>
<Stack.Screen
name="Finding Buddy"
component={BorrowMap}
options={{ title: "Finding Buddy" }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
export default App;
Folder Structure

