Skip to content

Type "numeric": input is reversed as soon as onChange handler is added #128

@AnnikaNissen

Description

@AnnikaNissen

I experimented with this framework today and found quite significant bug. Given the following component:

const MaskExample = () => {
	const [value, setValue] = useState("");

	console.log("value", value);

	return (
		<input
			type="text"
			value={value}
			onChange={(e) => {
				setValue(e.target.value);
			}}
			ref={withMask("numeric", {
				groupSeparator: " ",
				rightAlign: false,
			})}
		/>
	);
};

When I enter numbers, the output is reversed. So fx typing 123456 gives me the output 654 321.

The "reversing" happens, as soon as I add the onChange handler. For an uncontrolled input without onChange and value props, the component works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions