-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Form's normalize
does not work correctly with InputNumber
#34162
Comments
normalize
does not work correctly with InputNumber
Same bug in the case of using |
It is not a bug, InputNumber will show |
@afc163 ...If the same logic applied, it should behave like this:
But, right now 1. and 2. are behave differently. Moreover, if I switch from |
Try |
Using |
I suggest that creating a import { useState } from "react";
import { Form, InputNumber } from "antd";
import "antd/dist/antd.css";
const InputNumberLessThen5 = (props) => {
const [value, setValue] = useState(props.value);
const onChange = (v) => {
if (v >= 5) {
setValue(5);
} else {
setValue(v);
}
};
return <InputNumber {...props} value={value} onChange={onChange} />;
};
export default function App() {
const [form] = Form.useForm();
return (
<Form form={form}>
<Form.Item label="Must less than 5" name="lessThan5">
<InputNumberLessThen5 />
</Form.Item>
</Form>
);
} |
Your approach in codesandbox still NOT resolve the issue. If I type |
I think this issue is clearly a bug. The behavior of the first keystroke should not differ from other keystrokes, no matter we're using |
it won't work well with |
Reproduction link
Steps to reproduce
What is expected?
Without blurring the input, it should display "0"
What is actually happening?
The input display "087"
The text was updated successfully, but these errors were encountered: