-
Notifications
You must be signed in to change notification settings - Fork 2
/
Overlay.js
59 lines (46 loc) · 971 Bytes
/
Overlay.js
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
55
56
57
58
'use strict';
var React = require('react-native');
var {
View,
TouchableWithoutFeedback,
PropTypes,
} = React;
var StyleSheet = require('react-native').StyleSheet;
var noop = () => {};
var Overlay = React.createClass({
propTypes: {
onPressBackdrop: PropTypes.func,
isVisible: PropTypes.bool,
},
getDefaultProps() {
return {
isVisible: false,
onClose: noop,
onPressBackdrop: noop,
};
},
render() {
var {
onPressBackdrop,
isVisible,
Opacity
} = this.props;
if (!isVisible) {
return (<View/>);
}
return (<TouchableWithoutFeedback onPress={onPressBackdrop}>
<View style={[styles.backdrop,{opacity:Opacity}]}/>
</TouchableWithoutFeedback>)
}
});
var styles = StyleSheet.create({
backdrop: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
backgroundColor: '#000000',
}
});
module.exports = Overlay;