React Native `onPlay` prop firing continuously
We’re experiencing an unexpected issue with the `onPlay` prop of the React Native library, where the `onPlay` callback is continuously fired whilst the animation is playing.
This is a problem, as if we programatically pause the animation, the last `onPlay` event happens chronologically after, so this causes a logical issue in our code which restarts the playback. We had to introduce a state change in our code to protect against this unexpected callback behaviour.
The docs say this regarding the `onPlay` prop:
onPlay (optional) - Callback function that is called when animation or stateMachine has been started.
However, in reality, this is constantly being fired on what I suspect may be every key frame of the animation. As such, we need to protect against this in our code.
Are the docs description incorrect, or is the behaviour incorrect?
Many thanks 🙏