bootstrap-switch-button-react
bootstrap-switch-button-react copied to clipboard
Toggle Switch Disable property is not working as expected
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.
I have the same problem...
@gitbrent Any update on this?
@gitbrent I can fix this issue and make a pull request. If you approve, I will do it.
Same thing for onstyle property. If you change the parameter after the first render it will be ignored.
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
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>