-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathApp.tsx
More file actions
60 lines (56 loc) · 1.42 KB
/
App.tsx
File metadata and controls
60 lines (56 loc) · 1.42 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
import * as React from 'react';
import { Platform, SafeAreaView } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import ContentsButton from './ContentsButton';
import NativeDetector from './NativeDetector';
import Navigator from './Navigator';
import RuntimeDecoration from './RuntimeDecoration';
import Text from './Text';
const EXAMPLES = [
{
name: 'Text',
component: Text,
},
{
name: 'Runtime Decoration',
component: RuntimeDecoration,
},
{
name: 'Native Detector',
component: NativeDetector,
},
{
name: 'Contents Button',
component: ContentsButton,
},
];
const Stack = Navigator.create();
Stack.setRoutes(
Object.fromEntries(
EXAMPLES.map((example, index) => [
example.name.toLowerCase().replace(/\s+/g, ''),
{
component: example.component,
title: example.name,
rightButtonAction:
index === EXAMPLES.length - 1
? undefined
: () => {
Stack.navigateTo(
EXAMPLES[index + 1].name.toLowerCase().replace(/\s+/g, '')
);
},
},
])
)
);
export default function App() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaView
style={[{ flex: 1 }, Platform.OS === 'android' && { paddingTop: 50 }]}>
<Stack.Navigator />
</SafeAreaView>
</GestureHandlerRootView>
);
}