Skip to content

Formatting number with thousands separatorsΒ #96

@maxbbb

Description

@maxbbb

Is your feature request related to a problem? Please describe.

I want to format a number with thousands separators like this:

Input Output
1 1
12 12
123 123
1234 1,234
12345 12,345
123456 123,456

This same feature was requested here in the iOS library that this package uses and is implemented here

Describe the solution you'd like

Ideally the affinityFormat prop would behave in a way that would allow using the existing api to accomplish this, but given the native library creates a separate subclass NumberInputListener, it might be easiest to export a separate component for this specific use case.

Describe alternatives you've considered

I thought the following would work, but it doesn't

const Input = () => {
  return (
    <MaskedTextInput
      autocomplete={false}
      mask="[999],[999]"
      affinityFormat={['[9]', '[99]', '[999]', '[9],[999]', '[99],[999]', '[999],[999]']}
    />
  );
};

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions