In the process of trying to make my first app in react-native, I tried to set up the navigation in my app. When I changed the App.js from the default function it exports to this
import MovieList from './components/list';
import React from 'react';
import Detail from './components/detail';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
const AppNavigator = createStackNavigator({
MovieList: {screen: MovieList},
Detail: {screen: Detail},
})
const App = createAppContainer(AppNavigator)
export default App()
I got 2 errors:
"Uncaught error": cannot call a class as a function
Invariant Violation: "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.registerComponentwasn't called.
How can I fix these errors?