-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onMinimumReached and onMaximumReached events are always fired #18
Comments
Thanks for reporting the issue @misheki Have you got a repository or a reproducible demo that I could use to fix the issue? |
Hi @hannigand, sorry for the late response. I don't have a demo on this yet because I realized that it does not bother my requirements as of now. However, I am facing a different issue with the VALUE setting. Even though I hardcoded it with the number 3, it still increments and decrements when I click on the plus and minus buttons. Should I close this and open a new issue? Thanks! |
Hi @misheki - that's the expected behaviour. When you set the |
Hey @misheki , instead of this ; Please try this : Passing a function instead of an instruction will prevent the behavior you're describing. Cf. https://reactjs.org/docs/faq-functions.html#why-is-my-function-being-called-every-time-the-component-renders Cheers |
<UIStepper displayValue={true} initialValue={item.qty} minimumValue={1} maximumValue={10} value={item.qty} onMinimumReached={console.warn(' min reached')} onMaximumReached={console.warn(' max reached')} onIncrement={() => this.increment(item.id)} onDecrement={() => this.decrement(item.id)} />
The onMinimumReached and onMaximumReached events are always triggered upon render even when the value is 3.
By the way, my UIStepper is inside a FlatList (loop).
Am I lacking a setting?
The text was updated successfully, but these errors were encountered: