[英]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 在我的应用中,我为特定的动画使用
<AnimateNumber />
,但是当此过程完成时,我想分配其他任务,并且当<AnimateNumber />
完成时,我想这样做
This is how I use it in my code : 这就是我在代码中使用它的方式 :
render(){ return( <Image > . . . <AnimateNumber /> . . </Image> ); }
So my process goes like this : 所以我的过程是这样的 :
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') }}
您可以使用道具:
onFinish={() => { console.log('done') }}
assign it whatever function you want to do inside onFinish
将其分配给您想要在
onFinish
内onFinish
任何功能
refer this: https://github.com/wkh237/react-native-animate-number/blob/master/test/index.js 请参考: https : //github.com/wkh237/react-native-animate-number/blob/master/test/index.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.