Open jjpaul99 opened 4 years ago
This is my app.js code:
import { createAppContainer } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack'; import HomeScreen from './src/screens/HomeScreen'; import ComponentsScreen from './src/screens/ComponentsScreen';
const navigator = createStackNavigator( { Home: HomeScreen, Component: ComponentsScreen }, { initialRouteName: 'Components', defaultNavigationOptions: { title: "App" } } );
export default createAppContainer(navigator);
This is my ComponentsScreen.js file:
import React from 'react'; import { Text, StyleSheet } from 'react-native';
const ComponentsScreen = () => { return This is the Components Screen; };
const styles = StyleSheet.create ({ textStyle: { fontSize: 30 } });
export default ComponentsScreen;
// replace Components with Component like this initialRoutName:'Component'
initialRoutName:'Component'
//in ComponentScreen replace return This is Component Screen with code below:
return <View> <Text> This is Component Screen</Text></View>
This is my app.js code:
import { createAppContainer } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack'; import HomeScreen from './src/screens/HomeScreen'; import ComponentsScreen from './src/screens/ComponentsScreen';
const navigator = createStackNavigator( { Home: HomeScreen, Component: ComponentsScreen }, { initialRouteName: 'Components', defaultNavigationOptions: { title: "App" } } );
export default createAppContainer(navigator);
This is my ComponentsScreen.js file:
import React from 'react'; import { Text, StyleSheet } from 'react-native';
const ComponentsScreen = () => { returnThis is the Components Screen ;
};
const styles = StyleSheet.create ({ textStyle: { fontSize: 30 } });
export default ComponentsScreen;
import React from 'react'; import { Text, StyleSheet } from 'react-native';
const ComponentsScreen = () => { returnThis is the Components Screen ;
};
const styles = StyleSheet.create ({ textStyle: { fontSize: 30 } });
export default ComponentsScreen;