s-yadav / react-number-format

React component to format numbers in an input or as a text.
MIT License
3.9k stars 410 forks source link

How to create a similar money input? #807

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the issue and the actual behavior

This is my actual code that I'm using now and after I put the cursor at the end I can't enter anything, how can I get around it?

<NumericFormat
          prefix="$"
          value={formik.values.value || '00.00'}
          error={!!formik.errors.value}
          onValueChange={handleChange}
          valueIsNumericString={true}
          wrapperInput={styles.numberFormat}
          decimalScale={2}
          fixedDecimalScale={true}
          disabled={!isCustomAmount}
          allowLeadingZeros={true}
          isAllowed={({ floatValue }) => {
            return (
              floatValue === undefined || +floatValue < MAX_LIMIT_PAYMENT_PLAN
            );
          }}
          classes={{
            root: clsx(styles.inputPaymentPlan, {
              [styles.statementAmount]: !isCustomAmount,
            }),
            input: styles.inputSum,
            underline: styles.underlineHide,
          }}
          variant="standard"
          customInput={CustomInput}
        />

Describe the expected behavior

I expect that after the course is set at the end it will be possible to enter the amount

Provide a CodeSandbox link illustrating the

https://github.com/s-yadav/react-number-format/assets/105917929/8f71d178-6d80-43dc-8541-90e91ff660f9

issue