Skip to content

Instantly share code, notes, and snippets.

@Maluen
Created August 28, 2018 10:54
Show Gist options
  • Save Maluen/90c7d5ff9d866a312690fa2f68814b57 to your computer and use it in GitHub Desktop.
Save Maluen/90c7d5ff9d866a312690fa2f68814b57 to your computer and use it in GitHub Desktop.
startResetAnimation = () => {
this.resetAnimation = Animated.timing(this.state.screenOpacityAnim, {
toValue: 0,
duration: 500,
});
this.resetAnimationFinished = false;
this.resetAnimation.start(({ finished }) => {
if (finished) {
this.resetAnimationFinished = true;
}
});
}
cancelResetAnimation = () => {
this.resetAnimation.stop();
this.state.screenOpacityAnim.setValue(1);
}
finalizeResetAnimation = () => {
if (this.resetAnimationFinished) {
this.handleReset().then(() => {
this.state.screenOpacityAnim.setValue(1);
});
} else {
this.cancelResetAnimation();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment