-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
74 lines (71 loc) · 2.27 KB
/
App.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
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
/**
* NOTE: this is a comprehensive example of SlidingDrawer, including various
* use cases. Use this code, along with associated components to familiarize
* with more advanced use cases of SlidingDrawer.
*/
import * as React from 'react';
import {View, TouchableOpacity, Text} from 'react-native';
import {NonSlideOpen} from './src/NonSlideOpen/index';
import {Peekable} from './src/Peekable';
import {FadeBgNonSlideOpenNotTappable} from './src/FadeBgNonSlideOpenNotTappable';
import {FadeBgTappable} from './src/FadeBgTappable';
import {FadeBgPeekableNotTappable} from './src/FadeBgPeekableNotTappable';
import {Scrollable} from './src/Scrollable';
const App = () => {
const demos = {
Peekable: <Peekable />,
NonSlideOpen: <NonSlideOpen />,
FadeBgPeekableNotTappable: <FadeBgPeekableNotTappable />,
FadeBgNonSlideOpenNotTappable: <FadeBgNonSlideOpenNotTappable />,
FadeBgTappable: <FadeBgTappable />,
Scrollable: <Scrollable />,
};
const [selectedDemo, setSelectedDemo] =
React.useState<keyof typeof demos>('Peekable');
return (
<View
style={{
flex: 1,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
}}>
<View style={{marginBottom: 20}}>
{Object.keys(demos).map(key => {
const demoExample = key as keyof typeof demos;
return (
<TouchableOpacity
style={{
backgroundColor:
selectedDemo === demoExample ? 'blue' : 'lightgrey',
padding: 8,
borderRadius: 5,
alignItems: 'center',
}}
onPress={() => setSelectedDemo(demoExample)}
key={demoExample}>
<Text
style={{
color: selectedDemo === demoExample ? 'white' : 'grey',
fontSize: 15,
}}>
{demoExample}
</Text>
</TouchableOpacity>
);
})}
</View>
{demos[selectedDemo]}
</View>
);
};
export default App;