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

Animation bugs when more than one toggle #24

Closed
Strryke opened this issue Aug 21, 2023 · 2 comments
Closed

Animation bugs when more than one toggle #24

Strryke opened this issue Aug 21, 2023 · 2 comments

Comments

@Strryke
Copy link

Strryke commented Aug 21, 2023

Hi Alfie. Nice work, really like this package and been using it for a long time.

Today I was implementing a navbar, with mobile and desktop variants, and I created a ThemeToggle.jsx component and imported it into both variants, and noticed a bug with the animation.

image

I recreated it in a simple codepen. https://codesandbox.io/s/hopeful-wave-srvgy9?file=/src/App.js

I think it might have something to do with the CSS selectors? not too sure. I fixed it on my end currently by only rendering one variant of the navbar at a time (previously I was using CSS to hide). Would love it if you have the time to take a look :)

@AlfieJones
Copy link
Owner

AlfieJones commented Aug 29, 2023

Thanks for the support, it means a lot

It's to do with the svg id's on the svgs. The react components have a prop call idPrefix which lets you prefix all the id's which should avoid this scenario.

<Classic duration={750} idPrefix="1" />
<Classic duration={750} idPrefix="2" />

If you're using the svg's directly, then you would need to manually go through each id and ensure it is unique

@Strryke
Copy link
Author

Strryke commented Sep 11, 2023

ahh thanks for the reply!! that worked for me 😄

@Strryke Strryke closed this as completed Sep 11, 2023
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

2 participants