-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathDialogContent.tsx
54 lines (49 loc) · 1.2 KB
/
DialogContent.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
import * as React from 'react';
import { View, ViewStyle, StyleSheet, StyleProp } from 'react-native';
export type Props = React.ComponentPropsWithRef<typeof View> & {
/**
* Content of the `DialogContent`.
*/
children: React.ReactNode;
style?: StyleProp<ViewStyle>;
};
/**
* A component to show content in a Dialog.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { Dialog, Portal, Text } from 'react-native-paper';
*
* const MyComponent = () => {
* const [visible, setVisible] = React.useState(false);
*
* const hideDialog = () => setVisible(false);
*
* return (
* <Portal>
* <Dialog visible={visible} onDismiss={hideDialog}>
* <Dialog.Content>
* <Text variant="bodyMedium">This is simple dialog</Text>
* </Dialog.Content>
* </Dialog>
* </Portal>
* );
* };
*
* export default MyComponent;
* ```
*/
const DialogContent = (props: Props) => (
<View {...props} style={[styles.container, props.style]}>
{props.children}
</View>
);
DialogContent.displayName = 'Dialog.Content';
const styles = StyleSheet.create({
container: {
paddingBottom: 24,
paddingHorizontal: 24,
},
});
export default DialogContent;