-
Notifications
You must be signed in to change notification settings - Fork 0
/
stackNavigation.tsx
48 lines (44 loc) · 1.14 KB
/
stackNavigation.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React, {useEffect} from 'react';
import {useState} from 'react';
import {
Text, //First letter Capital
View,
Button,
StyleSheet,
TextInput,
FlatList,
ScrollView,
KeyboardAvoidingView,
} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
const stack = createNativeStackNavigator();
const App = () => {
return (
<NavigationContainer>
<stack.Navigator>
<stack.Screen name="Login" component={Login} />
<stack.Screen name="Home" component={Home} />
</stack.Navigator>
</NavigationContainer>
);
};
const Login = props => {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={{fontSize: 30}}>Login Screen</Text>
<Button
title="Go to Home Screen"
onPress={() => props.navigation.navigate('Home')}
/>
</View>
);
};
const Home = () => {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={{fontSize: 30}}>Home Screen</Text>
</View>
);
};
export default App;