-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathTest1637.tsx
More file actions
79 lines (72 loc) · 1.75 KB
/
Test1637.tsx
File metadata and controls
79 lines (72 loc) · 1.75 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import React from 'react';
import { TextInput, View } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { Button } from '@react-navigation/elements';
import { NavigationContainer } from '@react-navigation/native';
const App = () => {
const backgroundStyle = {
backgroundColor: '#fafffe', // isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<View
style={[
backgroundStyle,
{
flex: 1,
},
]}>
<View
style={{
flex: 1,
height: '100%',
}}>
<Navigation />
</View>
</View>
);
};
const Stack = createNativeStackNavigator();
function ScreenA({ navigation }) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button onPress={() => navigation.navigate('ScreenB')}>
Go to Screen B
</Button>
</View>
);
}
function ScreenB({ navigation }) {
return (
<View style={{ flex: 1, padding: 20, }}>
<TextInput
placeholder="Enter text"
style={{
height: 40,
width: '80%',
borderWidth: 1,
borderRadius: 5,
alignSelf: 'center',
paddingHorizontal: 10,
}}
autoFocus
/>
<Button onPress={() => navigation.goBack()}>
Go Back
</Button>
</View>
);
}
const Navigation = () => {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="ScreenA" component={ScreenA} />
<Stack.Screen name="ScreenB" component={ScreenB} options={{
headerShown: true,
fullScreenGestureEnabled: false,
}} />
</Stack.Navigator>
</NavigationContainer>
);
};
export default App;