React-number-format: Fill the input from right to left

Created on 4 Jul 2018  路  8Comments  路  Source: s-yadav/react-number-format

Hi, I didn't see anything on the documentation about reversing the order of the component to start filling from right to left, so I'm leaving it here: In some countries, like Brazil, currency is typically filled from right to left, so is there a way to accomplish this or it would be a new feature? Thanks!

Most helpful comment

If I may clarify for @TheoneLucas, we would like to see the input filled in the reverse order.
For example, I'd like to input $ 12.34 but I would like the numbers to enter right to left as you write them like so with padded leading zeros:
$ 0.00 --$ 0.01--$ 0.12-- $ 1.23--$ 12.34

If I attempt to change the direction of the input from left to right, to rtl I lose the ability to use the decimal.

All 8 comments

Just give text-align: right; to your input. You can pass className as prop and you can define that rule.

If I may clarify for @TheoneLucas, we would like to see the input filled in the reverse order.
For example, I'd like to input $ 12.34 but I would like the numbers to enter right to left as you write them like so with padded leading zeros:
$ 0.00 --$ 0.01--$ 0.12-- $ 1.23--$ 12.34

If I attempt to change the direction of the input from left to right, to rtl I lose the ability to use the decimal.

Yes, as stated by @chelsearoman-ca, I would like the numbers to fill from right to left, not align them.

Hey guys! I am interested in this feature as well. Did you find a solution?

@lutchobandeira Nope, I still think that it is responsability of the react-number-format to give an API to change it's own behavior, in this case the text direction. Given the number of thumbs up in this thread I stiil don't know why this thread was ignored and closed. I do think that this is an issue worth looking at and would love to hear from @s-yadav about a possible opening for implementation by the community, me included if needed.

@s-yadav any position for this? I need this feature

@s-yadav any update for this issue? @theonelucas you resolved this with another way?

For everyone here(mainly if you are brazilian), check #366, there you will find the answer.

Also this should help: https://stackblitz.com/edit/inputmask-reactjs-typescript-2ejtzv (#366 its implemented here)
Some info about the live code: It's not done, has some bugs, i'm working on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucasglobalsys picture lucasglobalsys  路  5Comments

fedulovivan picture fedulovivan  路  6Comments

tenkij picture tenkij  路  6Comments

erasmo-marin picture erasmo-marin  路  3Comments

nourahassan picture nourahassan  路  5Comments