File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React , { FC } from 'react' ;
2
+ import { Modal , TouchableWithoutFeedback , ModalBaseProps } from 'react-native' ;
3
+ import styled from 'styled-components/native' ;
4
+
5
+ import { ColumnProps , Column } from '../Column' ;
6
+
7
+ interface ModalComponentProps extends ColumnProps {
8
+ open : boolean ;
9
+ handleClose ?( ) : void ;
10
+ animationType ?: ModalBaseProps [ 'animationType' ] ;
11
+ }
12
+
13
+ const ModalComponent : FC < ModalComponentProps > = ( {
14
+ open,
15
+ children,
16
+ handleClose,
17
+ animationType = 'fade' ,
18
+ ...props
19
+ } ) => (
20
+ < Modal animationType = { animationType } transparent visible = { open } >
21
+ < TouchableWithoutFeedback style = { { flex : 1 } } onPress = { handleClose } >
22
+ < Container >
23
+ < TouchableWithoutFeedback >
24
+ < Column
25
+ width = '100%'
26
+ alignItems = 'center'
27
+ borderRadius = { 8 }
28
+ p = { 30 }
29
+ backgroundColor = 'white'
30
+ { ...props }
31
+ >
32
+ { children }
33
+ </ Column >
34
+ </ TouchableWithoutFeedback >
35
+ </ Container >
36
+ </ TouchableWithoutFeedback >
37
+ </ Modal >
38
+ ) ;
39
+
40
+ const Container = styled ( Column ) `
41
+ align-items: center;
42
+ justify-content: center;
43
+ background: black;
44
+ flex: 1;
45
+ padding: 0px 20px;
46
+ background: rgba(1, 1, 1, 0.4);
47
+ ` ;
48
+
49
+ export default ModalComponent ;
Original file line number Diff line number Diff line change
1
+ export { default as Modal } from './Modal' ;
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ export * from './Row';
4
4
export * from './Text' ;
5
5
export * from './Input' ;
6
6
export * from './KeyboardAwareScrollView' ;
7
+ export * from './Modal' ;
You can’t perform that action at this time.
0 commit comments