markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 101 forks source link

Switch should animate even when disabled #94

Open sbefort opened 3 years ago

sbefort commented 3 years ago

If you click on the switch and disable it immediately through a state update, it should still animate to the on/off positions while disabled. Instead, there is a white flash until the phantom animation completes, then it's put in a disabled status and appears again.

djD-REK commented 3 years ago

I achieved a similar effect in a project using the React Transition Group package. http://reactcommunity.org/react-transition-group/css-transition

Hope it helps!

markusenglund commented 3 years ago

Sandbox: https://codesandbox.io/s/friendly-goldstine-v5x43?file=/src/index.js For me it works just as expected - when clicked the switch changes position and turns grey, all smoothly animated. Could someone fork the sandbox/describe how to see the issue?