@@ -7,6 +7,7 @@ import StepHandler from './StepHandler';
77import { getNumberPrecision, num2str, validateNumber } from './utils/numberUtil';
88import useCursor from './hooks/useCursor';
99import useUpdateEffect from './hooks/useUpdateEffect';
10+ import useFrame from './hooks/useFrame';
1011
1112/**
1213 * We support `stringMode` which need handle correct type when user call in onChange
@@ -323,6 +324,8 @@ const InputNumber = React.forwardRef(
323324 };
324325
325326 // ========================== User Input ==========================
327+ const onNextPromise = useFrame();
328+
326329 // >>> Collect input value
327330 const collectInputValue = (inputStr: string) => {
328331 recordCursor();
@@ -338,6 +341,22 @@ const InputNumber = React.forwardRef(
338341 triggerValueUpdate(finalDecimal, true);
339342 }
340343 }
344+
345+ // Trigger onInput later to let user customize value if they want do handle something after onChange
346+ onInput?.(inputStr);
347+
348+ // optimize for chinese input experience
349+ // https://github.com/ant-design/ant-design/issues/8196
350+ onNextPromise(() => {
351+ let nextInputStr = inputStr;
352+ if (!parser) {
353+ nextInputStr = inputStr.replace(/。/g, '.');
354+ }
355+
356+ if (nextInputStr !== inputStr) {
357+ collectInputValue(nextInputStr);
358+ }
359+ });
341360 };
342361
343362 // >>> Composition
@@ -353,18 +372,7 @@ const InputNumber = React.forwardRef(
353372
354373 // >>> Input
355374 const onInternalInput: React.ChangeEventHandler<HTMLInputElement> = (e) => {
356- let inputStr = e.target.value;
357-
358- // optimize for chinese input experience
359- // https://github.com/ant-design/ant-design/issues/8196
360- if (!parser) {
361- inputStr = inputStr.replace(/。/g, '.');
362- }
363-
364- collectInputValue(inputStr);
365-
366- // Trigger onInput later to let user customize value if they want do handle something after onChange
367- onInput?.(inputStr);
375+ collectInputValue(e.target.value);
368376 };
369377
370378 // ============================= Step =============================
0 commit comments