-
Notifications
You must be signed in to change notification settings - Fork 0
/
DialogTest.tsx
43 lines (36 loc) · 2 KB
/
DialogTest.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
// create by LH ([email protected]) at 2020-04-11 11:20:12
import * as React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { Dialog, Button, SlideUpDialog } from '../../components';
import { Header, HeaderHeight, HeaderZindex } from '../Header';
import { useStackNav } from '../../hooks';
export const DialogTest: React.FunctionComponent = React.memo(function DialogTest(props) {
const { goback } = useStackNav();
const [showDialog, setShowDialog] = React.useState(false);
const [showSlideUpDialog, setShowSlideUpDialog] = React.useState(false);
return (
<View style={style.container.root}>
<Header onBack={goback} title="DialogTest" />
<Button style={{ marginTop: 30 }} title="open Dialog 1" onPress={() => setShowDialog(v => !v)} />
<View style={{ position: "relative", zIndex: 10 }}>
<Button style={{ marginTop: 30 }} title="open Dialog 2" onPress={() => setShowDialog(v => !v)} />
</View>
<Button style={{ marginTop: 30 }} title="open SlideUpDialog 1" onPress={() => setShowSlideUpDialog(v => !v)} />
<Dialog show={showDialog} style={{ zIndex: HeaderZindex + 1 }}>
<View style={{ width: 200, height: 200, backgroundColor: "white", borderRadius: 20, alignItems: "center" }}>
<Button style={{ marginTop: 30 }} title="close" onPress={() => setShowDialog(v => !v)} />
</View>
</Dialog>
<SlideUpDialog show={showSlideUpDialog} style={{ zIndex: HeaderZindex + 1 }} height={300}>
<View style={{ height: 300, backgroundColor: "white", alignItems: "center" }}>
<Button style={{ marginTop: 30 }} title="close" onPress={() => setShowSlideUpDialog(v => !v)} />
</View>
</SlideUpDialog>
</View>
);
});
const style = {
container: StyleSheet.create({
root: { flex: 1, alignItems: "center", position: "relative", paddingTop: HeaderHeight }
}),
};