简体   繁体   中英

how to assign another task when a component's function finishes in react native

In my app I use <AnimateNumber /> for a particular animation but right when this process finishes i want to assign some other task, and I want to do it when <AnimateNumber /> finishes how can I do that

This is how I use it in my code :

 render(){ return( <Image > . . . <AnimateNumber /> . . </Image> ); } 

So my process goes like this :

  1. screen loads
  2. a number animation occurs

and then, I need to give a response to user right when this number animation finishes

You could use the prop : onFinish={() => { console.log('done') }}

assign it whatever function you want to do inside onFinish

refer this: https://github.com/wkh237/react-native-animate-number/blob/master/test/index.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM