react-native-animated-overlay
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -37,3 +37,3 @@ import Exponent from 'exponent'; | ||
onPress={this.closeOverlay} | ||
showOverlay={this.state.overlayShow} | ||
overlayShow={this.state.overlayShow} | ||
/> | ||
@@ -40,0 +40,0 @@ </View> |
{ | ||
"name": "react-native-animated-overlay", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "React Native Animated Overlay support IOS & Android.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,2 +6,4 @@ ## React Native Animated Overlay | ||
[Try it with Exponent](https://exp.host/@jacklam718/animatedoverlay-example) | ||
 | ||
@@ -8,0 +10,0 @@ |
@@ -27,27 +27,18 @@ // @flow | ||
super(props); | ||
const toValue = props.overlayShow ? props.opacity : 0; | ||
this.state = { | ||
opacity: new Animated.Value(0), | ||
opacity: new Animated.Value(toValue), | ||
}; | ||
} | ||
componentDidMount() { | ||
if (this.props.overlayShow) { | ||
this.toValue(this.props.opacity); | ||
} | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
if (this.props.overlayShow !== nextProps.overlayShow) { | ||
const toValue = nextProps.overlayShow ? nextProps.opacity : 0; | ||
this.toValue(toValue); | ||
Animated.timing(this.state.opacity, { | ||
toValue, | ||
duration: this.props.animationDuration, | ||
}).start(); | ||
} | ||
} | ||
toValue(toValue) { | ||
Animated.timing(this.state.opacity, { | ||
toValue, | ||
duration: this.props.animationDuration, | ||
}).start(); | ||
} | ||
render() { | ||
@@ -54,0 +45,0 @@ let { pointerEvents } = this.props; |
42
7342
157