-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I unmount a component when its animation ends? #72
Comments
@jefflung Is the class SomeComponent extends Component {
keyFrames = [
{ transform: 'scale(1)', opacity: 1, offset: 0 },
{ transform: 'scale(.5)', opacity: 0.5, offset: 0.3 },
{ transform: 'scale(.667)', opacity: 0.667, offset: 0.7875 },
{ transform: 'scale(.6)', opacity: 0.6, offset: 1 },
];
timing = {
duration,
easing: 'ease-in-out',
delay: 0,
iterations: 2,
direction: 'alternate',
fill: 'forwards',
};
render() {
return (!this.state.finished && <Animated.div keyframes={this.keyFrames} timing={this.timing} onFinish={() => this.setState({finished: true})}>Something</Animated.div>)
}
} I haven't tested this, but should work.. |
Cool, thanks for your quick response. It works, thanks a lot! |
Thanks, it works well in Animated tag and AnimationSequence tag. However, in my case, if only the ID 1 component have to be unmounted after it's animation is finished, then ID 2 component appears and stays. Could you advice me again? Thanks. |
@jefflung yeah I can make some time to get a demo together of un-mounting components when the animation ends. Your code seems to be not formatted properly, so your example is hard to read.. |
@bringking Sorry, I just format well for my comment. Would you mind to check it again and I am grateful if you could advise, thanks. |
Hi, I found there is no object key onFinish in animatable.js , so I cant call this function with animatable tag. Would you mind to add onFinish to animatable when you have time, thanks. |
Hi, can I unmount a component when its animation ends, and could I specify this function to any component I want? Can I call a remove function at the end of the getKeyFrames function? or any way which can achieve my purpose? Besides, how can I unmount or set opacity 0 for the second component which is supposed not shown before the first component finished animation? Thanks.
The text was updated successfully, but these errors were encountered: