|
1 | 1 | import React from 'react'; |
2 | 2 | import { View, ViewPropTypes, StyleSheet } from 'react-native'; |
3 | 3 | import PropTypes from 'prop-types'; |
4 | | -import { Button } from '../../src/component/button'; |
| 4 | +import { Button } from './button'; |
5 | 5 | import { H4Text } from './text'; |
6 | 6 | import Icon from './icon'; |
| 7 | +import Escapable from './escapable'; |
7 | 8 | import { color } from './style'; |
8 | 9 |
|
9 | 10 | const styles = StyleSheet.create({ |
@@ -34,15 +35,20 @@ const styles = StyleSheet.create({ |
34 | 35 | }, |
35 | 36 | }); |
36 | 37 |
|
37 | | -const Modal = ({ title = '', onClose, children, style }) => ( |
38 | | - <View style={[styles.modal, style]}> |
39 | | - <H4Text style={styles.title}>{title.toUpperCase()}</H4Text> |
40 | | - <Button style={styles.cancelBtn} onPress={onClose}> |
41 | | - <Icon image="cancel-grey" style={styles.cancelIcon} /> |
42 | | - </Button> |
43 | | - {children} |
44 | | - </View> |
45 | | -); |
| 38 | +class Modal extends Escapable { |
| 39 | + render() { |
| 40 | + const { title = '', style, onClose, children } = this.props; |
| 41 | + return ( |
| 42 | + <View style={[styles.modal, style]}> |
| 43 | + <H4Text style={styles.title}>{title.toUpperCase()}</H4Text> |
| 44 | + <Button style={styles.cancelBtn} onPress={onClose}> |
| 45 | + <Icon image="cancel-grey" style={styles.cancelIcon} /> |
| 46 | + </Button> |
| 47 | + {children} |
| 48 | + </View> |
| 49 | + ); |
| 50 | + } |
| 51 | +} |
46 | 52 |
|
47 | 53 | Modal.propTypes = { |
48 | 54 | title: PropTypes.string.isRequired, |
|
0 commit comments