react-native-overlay
Advanced tools
Comparing version 0.4.2 to 0.5.0
@@ -8,51 +8,51 @@ /** | ||
var React = require('react-native'); | ||
var { | ||
View, | ||
PropTypes, | ||
StyleSheet, | ||
requireNativeComponent, | ||
} = React; | ||
var React = require('react'); | ||
var {View, StyleSheet, requireNativeComponent} = require('react-native'); | ||
type Props = { | ||
isVisible: boolean; | ||
isVisible: boolean | ||
} | ||
var Overlay = React.createClass({ | ||
propTypes: { | ||
/** | ||
* When this property is set to `true`, the Overlay will appear on | ||
* `UIWindowLevelStatusBar`, otherwise it will appear below that. | ||
*/ | ||
aboveStatusBar: React.PropTypes.bool, | ||
propTypes: { | ||
/** | ||
* When this property is set to `true`, the Overlay will appear on | ||
* `UIWindowLevelStatusBar`, otherwise it will appear below that. | ||
*/ | ||
aboveStatusBar: React.PropTypes.bool, | ||
/** | ||
* Determines the visibility of the Overlay. When it is not visible, | ||
* an empty View is rendered. | ||
*/ | ||
isVisible: React.PropTypes.bool, | ||
}, | ||
/** | ||
* Determines the visibility of the Overlay. When it is not visible, | ||
* an empty View is rendered. | ||
*/ | ||
isVisible: React.PropTypes.bool, | ||
}, | ||
getDefaultProps(): Props { | ||
return { | ||
aboveStatusBar: false, | ||
isVisible: false, | ||
} | ||
}, | ||
getDefaultProps(): Props | ||
{ | ||
return { | ||
aboveStatusBar: false, | ||
isVisible: false, | ||
} | ||
}, | ||
render() { | ||
var { | ||
isVisible, | ||
} = this.props; | ||
if (this.props.isVisible) { | ||
return ( | ||
<RNOverlay isVisible={true} style={styles.container} pointerEvents="none" aboveStatusBar={this.props.aboveStatusBar}> | ||
{React.Children.map(this.props.children, React.cloneElement)} | ||
</RNOverlay> | ||
); | ||
} else { | ||
return <View />; | ||
} | ||
}, | ||
render() | ||
{ | ||
if (this.props.isVisible) { | ||
return ( | ||
<RNOverlay | ||
isVisible={true} | ||
style={styles.container} | ||
pointerEvents="none" | ||
aboveStatusBar={this.props.aboveStatusBar}> | ||
{ | ||
React.Children.map(this.props.children, React.cloneElement) | ||
} | ||
</RNOverlay> | ||
) | ||
; | ||
} else { | ||
return <View/>; | ||
} | ||
}, | ||
}); | ||
@@ -63,13 +63,13 @@ | ||
var styles = StyleSheet.create({ | ||
container: { | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
borderWidth: 0, | ||
backgroundColor: 'transparent', | ||
}, | ||
}) | ||
container: { | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
borderWidth: 0, | ||
backgroundColor: 'transparent', | ||
}, | ||
}); | ||
module.exports = Overlay; | ||
module.exports = Overlay; |
{ | ||
"name": "react-native-overlay", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"description": "An <Overlay /> component that brings content inside to the front of the view regardless of its current position in the component tree.", | ||
@@ -5,0 +5,0 @@ "main": "Overlay.ios.js", |
@@ -9,2 +9,4 @@ ## react-native-overlay | ||
*In fact, as of 0.29.0 zIndex is supported on iOS and Android, so you should probably never use this.* | ||
### Add it to your project | ||
@@ -11,0 +13,0 @@ |
21330
101