Hi!
I have a doubt, is there a way to initialize my render method without start the animation? In my case, i have a menu icon inside a toolbar. This icon should rotate only the user touches it, But when this screen's rendered the icon rotate. How can i rotate the menu icon only the user interact with it? I Know about startAnimation() and stopAnimation() methods and i tried put the animation in state, but without success yet.
My App is for both platforms - Android and IOs
Thanks! and pardon about my bad English.
I'm in the same boat here, also looking for a good way to execute animation on a component (that might use 'ref' , the refs things in React)
Define your Animatable without the duration and animation props (you can still use others like easing), set a reference to it and trigger the animation programmatically with the animation and duration of your choice.
Example:
render() {
return (
<TouchableWithoutFeedback onPress={() => this.onPress()}>
<Animatable.View ref={ref => { this.animatable = ref }}>
<YourComponentHere />
</Animatable.View>
</TouchableWithoutFeedback>
);
}
Then in onPress():
onPress() {
this.animatable.rotate(800);
}
Most helpful comment
Define your Animatable without the
durationandanimationprops (you can still use others likeeasing), set a reference to it and trigger the animation programmatically with the animation and duration of your choice.Example:
Then in
onPress():