Closed kenime closed 4 years ago
Hi @kenime! Thanks for creating the PR!
Could you please describe in more detail what kind of issues are you referring to? I think your changes look sensible, but just want to understand exactly what are you fixing with this.
Thanks!
@braposo I was trying to pause the text loop by updating the interval to 0, but then I found that the timeout cannot be cleared such that the text loop will still go to the next child and then stopped.
By including this PR, the timeout will be cleared as expected, such that the text loop will immediately stop when interval is changed to 0.
The reason is that with animationframe, the loop function will update the requestId value after it is returned to caller, hence we need to create an object to hold the requestId and return the reference to object instead of directly return as value.
bump
sorry for the delay @kenime! All sounds quite sensible, thanks for taking the time to explain and fix the issue! Going to merge and release it as a new version!
This is now included in https://github.com/braposo/react-text-loop/releases/tag/v2.3.0
@braposo Greeting! let me know if you need any further description on this PR.