Skip to content

Commit 8b74fd6

Browse files
author
ORAZIO SPADA
committed
fix: resolve react-number-format compatibility by refining compositionEnd handling
1 parent 0f81074 commit 8b74fd6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Input.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
117117
inputRef.current?.selectionEnd || 0,
118118
]);
119119
}
120-
} else if (info.source === 'compositionEnd') {
121-
// Avoid triggering twice
122-
// https://github.com/ant-design/ant-design/issues/46587
123-
return;
124120
}
121+
122+
// Always update the value state
125123
setValue(cutValue);
126124

127-
if (inputRef.current) {
125+
// Only trigger onChange if value has actually changed
126+
// This prevents double-firing (issue #46587) while still allowing
127+
// external wrappers like react-number-format to work (issue #46999)
128+
if (inputRef.current && cutValue !== formatValue) {
128129
resolveOnChange(inputRef.current, e, onChange, cutValue);
129130
}
130131
};

0 commit comments

Comments
 (0)