I am trying to use react-number-format (NumberFormat) to format a numeric value within the material ui TextField. In this is example I can type new number characters, but I cannot remove any number characters using the backspace key. I also cannot use the arrow or the delete keys. The only way I can remove any number character is to select those characters with the mouse and press the space bar.
While not mine, the following code sandbox replicates what I am getting: https://codesandbox.io/s/material-demo-iny12?file=/demo.tsx
function NumberFormatCustom(props) {
const { inputRef, onChange, ...other } = props;
return (
<NumberFormat
{...other}
customInput={TextField}
getInputRef={inputRef}
onValueChange={values => {
onChange({
target: {
value: values.value,
},
});
}}
/>
);
}
<TextField
margin="dense"
fullWidth={true}
value={value}
onChange={handleNumberChanged}
variant="outlined"
autoComplete="off"
type="number"
InputProps={{
inputComponent: NumberFormatCustom,
}}