-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat: trigger props.onStep when value stepps up/down #269
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/input-number/jdiwzcv23 |
Codecov Report
@@ Coverage Diff @@
## master #269 +/- ##
==========================================
+ Coverage 92.99% 93.01% +0.01%
==========================================
Files 1 1
Lines 371 372 +1
Branches 134 135 +1
==========================================
+ Hits 345 346 +1
Misses 26 26
Continue to review full report at Codecov.
|
src/InputNumber.tsx
Outdated
@@ -613,6 +613,7 @@ class InputNumber extends React.Component<Partial<InputNumberProps>, InputNumber | |||
val = props.min; | |||
} | |||
this.setValue(val, null); | |||
if (props.onStep) props.onStep(type, val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onStep(value, info: { offset: number, type: 'up' | 'down' })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
... to tell the source of the value change
In certain scenarios, such as Yuque Show, value changes are only necessary to handle in following cases:
props.onChange triggers too often since any temporary edits change value.