-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
66 lines (60 loc) · 1.83 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
import { useEffect, useState } from "react"
import { StyleSheet, View } from "react-native"
import { GestureHandlerRootView } from "react-native-gesture-handler"
import { BottomSheetComponent } from "./src/components/BottomSheetComponent"
import { MyButton } from "./src/components/MyButton"
import { Popup } from "./src/components/Popup"
export default function App() {
const [showBottomSheet, setShowBottomSheet] = useState(false)
const [showPopup, setShowPopup] = useState(false)
const [enablePopUp, setEnablePopUp] = useState(true)
const [enableBottomSheet, setEnableBottomSheet] = useState(true)
useEffect(() => {
if (showBottomSheet) {
setEnablePopUp(false)
} else {
setEnablePopUp(true)
}
}, [showBottomSheet])
useEffect(() => {
if (showPopup) {
setEnableBottomSheet(false)
} else {
setEnableBottomSheet(true)
}
}, [showPopup])
return (
<GestureHandlerRootView
style={{ flex: 1, paddingTop: 50, backgroundColor: "#edeef0" }}
>
<View style={styles.container}>
<MyButton
onPress={() => {
setShowBottomSheet(!showBottomSheet)
}}
disabled={!enableBottomSheet}
title={`${showBottomSheet ? "Hide" : "Show"} Bottom Sheet`}
/>
<MyButton
onPress={() => {
setShowPopup(!showPopup)
}}
disabled={!enablePopUp}
title={`${showPopup ? "Hide" : "Show"} Popup`}
/>
<Popup showPopup={showPopup} setShowPopup={setShowPopup} />
<BottomSheetComponent
showBottomSheet={showBottomSheet}
setShowBottomSheet={setShowBottomSheet}
/>
</View>
{/* <View style={styles.popupWrap}> */}
</GestureHandlerRootView>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
},
})