简体   繁体   English

当组件的功能在本地响应中完成时如何分配另一个任务

[英]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 : 所以我的过程是这样的

  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') }} 您可以使用道具: onFinish={() => { console.log('done') }}

assign it whatever function you want to do inside onFinish 将其分配给您想要在onFinishonFinish任何功能

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.

相关问题 如何将 function 分配给 React 中另一个组件的按钮? - How do I assign a function to a button from another component in React? 仅在React中另一个函数完成运行时才调用函数 - Calling a function only when another function finishes running in React 我如何从另一个组件调用 function 以响应本机? - How would I call a function from another component in react native? React Native:如何从另一个组件调用 function - React Native: How to call a function from another component 如何将按钮组件的标题传递给 React Native 中的函数 - How to pass Button component's title into a function in React Native React 在 onChange 函数中如何更新另一个自定义组件的状态并传入一个值? - In React when in onChange function how to update another custom component's state and pass a value in? 如何在 React Native 中从另一个功能组件更改一个功能组件的状态? - How to change state of one function component from another function component in React Native? React Native:从另一个组件在一个组件中运行一个函数 - React Native: Run a function in a component from another component 如何将值 onClick 从不同的组件分配给 React 中的另一个组件 - How to assign value onClick from different component to another component in React 如何在另一个组件上运行 React Native 生命周期 - How To Run React Native lifecycle on another Component
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM