Created
July 29, 2018 07:45
-
-
Save fzyzcjy/711abab472af21997157514062d6dc3a to your computer and use it in GitHub Desktop.
Modal.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render() { | |
if (!this.state.rendered) return null; | |
const { children, dismissable } = this.props; | |
return ( | |
<Animated.View | |
accessibilityViewIsModal | |
accessibilityLiveRegion="polite" | |
style={[{ opacity: this.state.opacity }, styles.wrapper]} | |
> | |
<View | |
style={[ | |
StyleSheet.absoluteFill, | |
{ backgroundColor: "rgba(0, 0, 0, .5)" } | |
]} | |
/> | |
{dismissable && ( | |
<TouchableWithoutFeedback onPress={this._hideModal}> | |
<View style={StyleSheet.absoluteFill} /> | |
</TouchableWithoutFeedback> | |
)} | |
{/* <Animated.View style={[{ opacity: this.state.opacity }]}> */} | |
<Animated.View style={[{ opacity: this.state.opacity, flex: 1 }]}> | |
{children} | |
</Animated.View> | |
</Animated.View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment