React Native Animated Loop start callback -


i struggling react native animations here. outcome simple, have animated.image want spin.
good, until want loop thru animation n times , when stops.
have following code .

animated.loop(   animated.timing(this.state.spin, {     tovalue: 360,     duration: 1000,     easing: easing.linear,     usenativedriver: true,   }), {     iterations: 3   } ).start(() => {   console.log('done'); }); 

it spins 3 times per loop iteration no callback fired when animation ends.

here expo replicates this: https://snack.expo.io/s1pjnfb9-

try code below

animated.loop(   animated.timing(this.state.spin, {     tovalue: 360,     duration: 1000,     easing: easing.linear,     usenativedriver: true,   }), {     iterations: 3   } ).start(event => {     if (event.finished) {       console.log('finished');     }   }); 

i added check on event response.

hope helps.


Comments

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -