bootstrap-switch-button-react icon indicating copy to clipboard operation
bootstrap-switch-button-react copied to clipboard

Toggle Switch Disable property is not working as expected

Open Tichandr opened this issue 4 years ago • 6 comments

I am facing an issue in enabling/disabling the toggle button.

Initial state I have set the property of disabled = {true}, this is working fine. But I wanted to enable it back and this state is not working. Can you please look in to this.

Tichandr avatar Jul 16 '20 18:07 Tichandr

I have the same problem...

Banych avatar Jul 28 '20 12:07 Banych

@gitbrent Any update on this?

Tichandr avatar Jul 29 '20 15:07 Tichandr

@gitbrent I can fix this issue and make a pull request. If you approve, I will do it.

zfarhad avatar Sep 24 '20 14:09 zfarhad

Same thing for onstyle property. If you change the parameter after the first render it will be ignored.

mskzo avatar Nov 12 '20 17:11 mskzo

Hey there @gitbrent ! First of all thanks for the library, really appreciated. Any plan on fixing this issue for the "disabled", "onstyle" and "offstyle" properties value updating? I'm experiencing the issue too :S

DXAizpiri avatar Oct 15 '21 09:10 DXAizpiri

If this can help anyone else. I quickly hacked around this by wrapping the switch in a div, and removing pointer events via a class or style. You can also play with opacity to make it look faded. Note that you can use bootstrap 5 classes 'pe-none' and 'pe-auto' instead of your own.

<div className={`${isDisabledCondition ? 'noPointerEvents', 'inheritPointerEvents'}`}> <BootstrapSwitchButton /> </div>

<div style={{pointerEvents: `${isDisabledCondition? 'none' : 'inherit'}`}}> <BootstrapSwitchButton /> </div>

bosepher avatar May 26 '23 16:05 bosepher