Skip to content

Toggle Switch Disable property is not working as expected #29

@Tichandr

Description

@Tichandr

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.

Activity

Banych

Banych commented on Jul 28, 2020

@Banych

I have the same problem...

Tichandr

Tichandr commented on Jul 29, 2020

@Tichandr
Author

@gitbrent Any update on this?

zfarhad

zfarhad commented on Sep 24, 2020

@zfarhad

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

mskzo

mskzo commented on Nov 12, 2020

@mskzo

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

DXAizpiri

DXAizpiri commented on Oct 15, 2021

@DXAizpiri

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

bosepher

bosepher commented on May 26, 2023

@bosepher

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Banych@mskzo@zfarhad@Tichandr@DXAizpiri

        Issue actions

          Toggle Switch Disable property is not working as expected · Issue #29 · gitbrent/bootstrap-switch-button-react