-
Notifications
You must be signed in to change notification settings - Fork 67
Switch is not switching #44
Comments
It was a problem with the state of the input checked property. Also, now using true or false for the checked value |
Can you explain what you mean by this? How did you get it working? |
I'll try and remember, but it was many projects ago. To clarify, it was how I was setting the state onChange and I was using 1 or 0, changed that to using true or false, which seems to make a difference. I hope the code sample helps.
|
Thanks, I finally figured out what was wrong in my case: it needs an adjacent label element, and it needs to have an |
My issue was coping the html code to react. label for element needs to be changed to htmlFor |
When I try to use my switch like the one in the demo, it doesn't move.
I can see it register the click in my handler when I click it or use the spacebar when it's focused.
Since I'm loading these dynamically, I'm generating my id, name and label "for" with all the same value, IE:
isActive-n
.The switch is loading properly on the page, it looks great, it just doesn't move. I've tried a few different id/lable value formats and nothing works yet.
Here is the switch part of my react component:
The text was updated successfully, but these errors were encountered: