-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Checkbox slider with lose animation if label changes #1881
Comments
The Checkbox uses I'm not sure this is fixable without some ugly hacks or a whole lot of work. We would have to get around the basis of React, replacing nodes when props/state change. A WorkaroundNot ideal, but one workaround is to update the label after the animation is complete: https://codepen.io/levithomason/pen/JyPRXG I'll leave this open for a bit and see if anyone has any smarter ideas than myself. PRs and engineering very much appreciated. |
Brand spankin' new here so please forgive my ignorance and lack of understanding of the codebase...that being said however... What about simply adding a span around the text of the label? This way the pseudo elements will still be attached to the label element itself while the span element itself is what is changing. I attempted to look into testing this out, however I'm going to definitely need to familiarize myself before giving that a shot. Seems to be created using factories, so this will affect other elements as well. |
I will close this for housekeeping. Issue really exists, however it a logical backgroud and I'm not sure that we responsive for its fix. The easies way is use an wrapper element as @overthemike suggested: <Checkbox
checked={enabled}
label={<label>{label}</label>}
slider
/> |
Steps
Expected Result
Animated Checkbox slider
Actual Result
No animation
Version
0.71.1
Testcase
https://codepen.io/andv/pen/YQmWJp?editors=0010
The text was updated successfully, but these errors were encountered: