-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathindex.tsx
More file actions
106 lines (98 loc) · 2.73 KB
/
index.tsx
File metadata and controls
106 lines (98 loc) · 2.73 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import React, { useState } from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import { FormSheet } from 'react-native-screens/experimental';
import type { ScenarioDescription } from '@apps/tests/shared/helpers';
import { createScenario } from '@apps/tests/shared/helpers';
import { StackContainer } from '@apps/shared/gamma/containers/stack';
import { CenteredLayoutView } from '@apps/shared/CenteredLayoutView';
import { Colors } from '@apps/shared/styling';
import { StackNavigationButtons } from '@apps/tests/shared/components/stack-v5/StackNavigationButtons';
const scenarioDescription: ScenarioDescription = {
name: 'FormSheet with Nested Stack v5',
key: 'test-stack-v5-in-form-sheet-ios',
details: 'Test nesting Stack v5 inside a FormSheet',
platforms: ['ios'],
};
export function App() {
const [isOpen, setIsOpen] = useState(false);
return (
<View style={styles.container}>
<Text style={styles.title}>FormSheet with nested StackV5</Text>
<Button
title="Open FormSheet"
color={Colors.primary}
onPress={() => setIsOpen(true)}
/>
<FormSheet
isOpen={isOpen}
onNativeDismiss={() => setIsOpen(false)}
detents={[0.6, 1.0]}>
<View style={styles.sheetContent}>
<StackSetup />
</View>
</FormSheet>
</View>
);
}
function StackSetup() {
return (
<StackContainer
routeConfigs={[
{
name: 'Home',
Component: HomeScreen,
options: {},
},
{
name: 'A',
Component: AScreen,
options: {
headerConfig: { title: 'A' },
},
},
]}
/>
);
}
function HomeScreen() {
return (
<CenteredLayoutView style={{ backgroundColor: Colors.BlueLight40 }}>
<Text style={styles.screenText}>Home Screen</Text>
<StackNavigationButtons isPopEnabled={false} routeNames={['A']} />
</CenteredLayoutView>
);
}
function AScreen() {
return (
<CenteredLayoutView style={{ backgroundColor: Colors.YellowLight40 }}>
<Text style={styles.screenText}>Screen A</Text>
<StackNavigationButtons isPopEnabled={true} routeNames={['A']} />
</CenteredLayoutView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: Colors.offBackground,
},
title: {
fontSize: 20,
fontWeight: 'bold',
marginBottom: 20,
color: Colors.text,
},
sheetContent: {
flex: 1,
backgroundColor: Colors.background,
},
screenText: {
color: Colors.text,
fontSize: 20,
fontWeight: 'bold',
textAlign: 'center',
marginBottom: 10,
},
});
export default createScenario(App, scenarioDescription);