Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make the placeholder sign two characters after decimal point #47

Open
ghost opened this issue Jul 16, 2020 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Jul 16, 2020

Thank you for the library. How can I make the placeholder that comes after decimal point 2 digits? For example when user tries to write 12.35 after writing 12 and writing '.' the component automatically shows '' placeholder with one digit like this 12. . When user tries to write 12.35 he ends up writing 12.53 because it accepts one and returns back to start after the decimal point. When there are 2 decimal digits so it has to be '__' or nothing at all. Without that component unusable.
I tried to change how placeholderChar works in the source without success.

    <TextMask
                Component={TextInputAdapter}
                autoFocus={false}
                value={serializeDecimal(values.discount_amount, 'currencyinput')}
                mask={currencyMask}
                blur={e => handleDiscountChange(e.nativeEvent.text, 'amount')}
              />


   currencyMask = createNumberMask({
      prefix: '$',
      decimalSymbol: maskValues.decimalSymbol,
      thousandsSeparatorSymbol: maskValues.thousandsSeparatorSymbol,
      decimalLimit: 2,
      requireDecimal: maskValues.requireDecimal,
      suffix: maskValues.currencySuffix,
      includeThousandsSeparator: true,
      allowLeadingZeroes: false,
      allowDecimal: true,
      allowNegative: true
    });
@ghost ghost changed the title How can I make the placeholder after decimal sign tow characters? How can I make the placeholder sign two characters after decimal point Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants