-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathDialogWithDismissableBackButton.tsx
More file actions
38 lines (34 loc) · 916 Bytes
/
DialogWithDismissableBackButton.tsx
File metadata and controls
38 lines (34 loc) · 916 Bytes
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
import * as React from 'react';
import { Button, Portal, Dialog, Colors } from 'react-native-paper';
import { TextComponent } from './DialogTextComponent';
const DialogWithDismissableBackButton = ({
visible,
close,
}: {
visible: boolean;
close: () => void;
}) => (
<Portal>
<Dialog
onDismiss={close}
visible={visible}
dismissable={false}
dismissableBackButton
>
<Dialog.Title>Alert</Dialog.Title>
<Dialog.Content>
<TextComponent>
This is an undismissable dialog, however you can use hardware back
button to close it!
</TextComponent>
</Dialog.Content>
<Dialog.Actions>
<Button textColor={Colors.tertiary50} disabled>
Disagree
</Button>
<Button onPress={close}>Agree</Button>
</Dialog.Actions>
</Dialog>
</Portal>
);
export default DialogWithDismissableBackButton;