Skip to content

Commit ebd47b1

Browse files
Merge pull request #24 from naveteam/feat/modal-component
feat: created modal component
2 parents 597e5df + 7a9cb8a commit ebd47b1

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Modal } from './Modal';

template/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export * from './Row';
44
export * from './Text';
55
export * from './Input';
66
export * from './KeyboardAwareScrollView';
7+
export * from './Modal';

0 commit comments

Comments
 (0)