gipyeong-lee / react-ion-slider

react-ion-slider
1 stars 0 forks source link

Disable attribute doesn't seem to be working #7

Closed Nosnibor35 closed 3 years ago

Nosnibor35 commented 3 years ago

Hello, I have the following set up:

"dependencies": { "next": "10.0.7", "react": "17.0.1", "react-dom": "17.0.1", "react-ion-slider": "^1.0.15" },

I am using a setState() to set a variable (isDisabled) to true when I click a button so that all the 'IonRangeSlider' components become disabled, the component is: <IonRangeSlider type={"double"} skin={"big"} min={0} max={145} from={from} to={to} disable={isDisabled} onChange={(event) => { setFrom(event.from); setTo(event.to); }} /> To test this I have a

that displays the isDisable variable and it gets set OK. So I'm thinking that the variable is getting set and the re-render is obviously happening to display the true/false values, so do you think this could be the component?

Thanks

Martin PS. When I set these manually it all works as expected.

gipyeong-lee commented 3 years ago

@Nosnibor35 hi XD actually you can use below props. image

Nosnibor35 commented 3 years ago

Hello @gipyeong-lee,

Thank for the reply, maybe I am coding it incorrectly as it only works when I manually set it to true (same as disable). I have a useState set up for a variable called isDisabled and in the component I use block={isDisabled}. I have an onClick that invokes a function with setIsDisabled(true); - so it all seems straight forward to me but it's not working as I would expect. What do you think, am I doing something wrong?

gipyeong-lee commented 3 years ago

sorry too much late. when i implement disable={true} props in component. it seems blow. i found issue, when changed prop current library doesns't change automatically, so i fixed when props change update automatically. check with 1.0.16

image