I use https://github.com/RobinHerbots/Inputmask with antd InputNumber
My code:
function InputNumberWithComma({ step, ...restProps }) {
const ONLY_NUMBERS_REGEXP = '^-?\\d*[.,]?\\d*$';
const inputNumberRef = useRef();
useEffect(() => {
Inputmask({ regex: ONLY_NUMBERS_REGEXP }).mask(inputNumberRef.current);
}, []);
const formatter = (value, { userTyping } = {}) => {
console.log('qq11', value, 'userTyping: ', userTyping);
return value;
};
return <InputNumber {...restProps} step={step} formatter={formatter} ref={inputNumberRef} />;
}
I've wrote few numbers in input. I got userTyping === true inside formatter funtion . But when I press backspace userTyping === false. If I remove Inputmask component and try press backspace again I'll get userTyping === true. Is there solution when InputMask doesn't overwrite userTyping state from InputNumber for backspace and delete buttons?