1 | import React, { Component, } from 'react';
|
2 | import { Modal, TouchableWithoutFeedback, View, StyleSheet, } from 'react-native';
|
3 | export class Props {
|
4 | }
|
5 | const styles = StyleSheet.create({
|
6 | overlay: {
|
7 | backgroundColor: 'rgba(0, 0, 0, .3)',
|
8 | position: 'absolute',
|
9 | top: 0,
|
10 | bottom: 0,
|
11 | left: 0,
|
12 | right: 0,
|
13 | },
|
14 | });
|
15 | export default class Overlay extends Component {
|
16 | constructor() {
|
17 | super(...arguments);
|
18 | this.NOOP = () => { };
|
19 | }
|
20 | render() {
|
21 | const { children, onPress, style, visible } = this.props;
|
22 | return (React.createElement(Modal, { animationType: "fade", onRequestClose: this.NOOP, transparent: true, visible: visible },
|
23 | React.createElement(TouchableWithoutFeedback, { onPress: onPress },
|
24 | React.createElement(View, { style: [styles.overlay, style] })),
|
25 | children));
|
26 | }
|
27 | }
|
28 | Overlay.defaultProps = new Props();
|
29 |
|
\ | No newline at end of file |