forked from ruslanzharkov/react-native-bottom-sheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
75 lines (67 loc) · 1.67 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
75
/**
* 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
*/
import React, {useCallback, useState} from 'react';
import {StyleSheet, View, SafeAreaView, Image} from 'react-native';
import {BottomSheet} from './src/bottomSheet';
import {Button} from './src/components/button';
const BurgerCatGif = require('./gifs/burger.gif');
const App = () => {
const [isOpen, setOpen] = useState<boolean>(false);
const openDrawer = useCallback(() => {
setOpen(true);
}, []);
const closeDrawer = useCallback(() => {
setOpen(false);
}, []);
return (
<>
<View style={styles.flexContainer}>
<SafeAreaView>
<View style={styles.buttonContainer}>
<Button title="Open Bottom Sheet" onPress={openDrawer} />
</View>
</SafeAreaView>
<BottomSheet
isOpen={isOpen}
openedPercentage={0.7}
onClose={closeDrawer}>
<View style={styles.buttonContainer}>
<Button title="Close Bottom Sheet" onPress={closeDrawer} />
</View>
<Image style={styles.gif} source={BurgerCatGif} />
</BottomSheet>
</View>
</>
);
};
const styles = StyleSheet.create({
flexContainer: {
flex: 1,
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'center',
paddingVertical: 30,
},
button: {
width: 150,
backgroundColor: 'indigo',
padding: 10,
borderRadius: 10,
},
gif: {
flex: 1,
width: '100%',
},
buttonText: {
color: '#fff',
},
});
export default App;