Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onFinish fires randomly on marquee start #101

Open
kubagp1 opened this issue Mar 26, 2024 · 1 comment
Open

onFinish fires randomly on marquee start #101

kubagp1 opened this issue Mar 26, 2024 · 1 comment

Comments

@kubagp1
Copy link

kubagp1 commented Mar 26, 2024

onFinish function gets called randomly when marquee starts. In this demo i use page refresh to demonstrate and it happens rarely, but in an application I'm writing this happens around 33% of times when Marquee gets rendered (maybe something to do with more complex logic than this basic example). In my project I use the onFinish callback to hide the marquee after it had finished scrolling, resulting in it being hidden one frame(? not sure it's exactly one frame but it flashes briefly) after the initial render. I'm using Chrome 123 in incognito mode. Doesn't happen on Firefox.

Desktop.2024.03.26.-.17.29.25.04.DVR.mp4

https://codesandbox.io/p/devbox/gw3gt6?file=%2Fsrc%2FApp.jsx%3A17%2C23

@kubagp1
Copy link
Author

kubagp1 commented Mar 26, 2024

Workaround:

<Marquee onFinish={handleChange as () => void}>
const handleChange = (e: { elapsedTime: number }) => {
  if (e?.elapsedTime === 0) return;
  
  // Do your stuff...
}

Would be nice if type on onFinish was correct out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant