arnthor3 / react-bootstrap-toggle

Bootstrap-toggle without the JQuery dependencies
Other
53 stars 17 forks source link

Any disable api? #28

Closed ido1wald closed 5 years ago

ido1wald commented 6 years ago

The disable props on the button is kinda buggy. Any other solution?

arnthor3 commented 6 years ago

What kind of a browser are you using? I admit I only test in Chrome and Firefox. In what way is it buggy?

I think you could just return false from the onclick handler to at least not toggle the states.

If you give me a better description I can check this out tonight.

ido1wald commented 6 years ago

Thanks for your comment, I've closed the report since it's irrelevant. The bug is when you're using the ToggleButton with react bootstrap tabs, the ToggleButton can't find it's css height so it turns out bad and "buggy" The solution is to update the ToggleButton component after the ToggleButton's tab was selected

arnthor3 commented 6 years ago

Ah, I understand. It's rendered with no dimensions and when the visibility is toggled it does not recalculate the width and height. I will add resize observer to the toggle as a prop.

<Toggle 
  {...restOfProps}
  recalculateOnResize={true}
/>

That way you don't have to manually update the component.

ido1wald commented 6 years ago

That's really nice :) I just added a style tag to the component to have a fixed size such as

<Toggle 
style = { {height: "100px", width: "100px" }} 
/>

Thanks for all the effort :)

arnthor3 commented 6 years ago

Just released 2.3.0, it does include the resize prop. I am going to leave this open until I have updated the tests accordingly. Thanks for the catch.