Reputation: 301
I have followed the documentation and also the solutions from stackoverflow,I still keep getting the error. This is my code. What am I doing wrong?
import React, { Component } from 'react';
import { Button, View, Text, StyleSheet } from 'react-native';
import { createStackNavigator,createAppContainer } from 'react-navigation';
import MainScreen from './components/MainScreen';
export default class App extends React.Component {
render() {
return <AppStackNavigator />;
}
}
const AppStackNavigator = createStackNavigator({
Main: {
screen: MainScreen,
},
});
export const Apps = createAppContainer(AppStackNavigator)
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Upvotes: 1
Views: 3195
Reputation: 10825
You're almost correct, just use Apps in you root component:
const AppStackNavigator = createStackNavigator({
Main: {
screen: MainScreen,
},
});
const Apps = createAppContainer(AppStackNavigator)
export default class App extends React.Component {
render() {
return <Apps />;
}
}
Upvotes: 3