s-yadav / react-number-format

React component to format numbers in an input or as a text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot change value

rwb196884 opened this issue · comments

const NumberFormatCustom = (props: NumberFormatProps) => {
  const { inputRef, ...other } = props;

  return (
    <NumberFormat
      {...other}
      readOnly={false}
      disabled={false}
      getInputRef={inputRef}
      thousandSeparator=","
      //decimalScale={props.decimalScale}
      fixedDecimalScale={true}
      placeholder={moneyPlaceholder}
      //isNumericString
      onValueChange={(values: NumberFormatValues) => {
        console.log(`NumberFormat.onValueChange ${JSON.stringify(values)}`);
      }}
    />
  );
};

A form element appears with a formatted value, but the value can't be changed. The onValueChange never fires, nor does the onChange that's hidden in ...other.

Can this be used for editing values or not?

Can you create a sandbox where it's not working?