Socket
Book a DemoInstallSign in
Socket

react-native-international-number-input

Package Overview
Dependencies
Maintainers
9
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-international-number-input

A number input with support for different numeral systems.

0.0.6
latest
Source
npmnpm
Version published
Maintainers
9
Created
Source

react-native-international-number-input

License: MIT npm version

A wrapper over react-native's TextInput that accepts numbers in the specified numeral system.

In plain English: a simple text input component that allows users to enter numbers in their native language. For example, Arabic speakers can enter Eastern-Arabic numbers. The application will receive the number translated/transformed to a number.

Installation

NPM

npm install react-native-international-number-input

Yarn

yarn add react-native-international-number-input

Usage

Full example

The InternationalNumberInput is a thin wrapper over react-native's TextInput component. It accepts all props that TextInput does and some additional ones.

InternationalNumberInput is a managed/controlled component. You must manage the current state/value of the component as described below. Read more about controlled components..

import React from 'react';

import {
    NumeralSystems,
    InternationalNumberInput,
} from 'react-native-international-number-input';

const MyComponent = () => {
    const [value, setValue] = React.useState(null);

    return (
        <InternationalNumberInput
            value={value}
            onChange={setValue}
            numeralSystem={NumeralSystems.EasternArabic}
        />
    );
};

Characteristics

  • Validates numbers based on the specified keyboardType.

    • keyboardType=decimal-pad would only allow decimal numbers to be inputted.
    • keyboardType=number-pad would only allow integers to be inputted.

    keyboardType not only changes the keyboard type the user is shown but it also adds extra validation and prevents the user from entering invalid input.

  • Returns null in the onChange callback when the input is invalid or non-existent/empty.

FAQs

Package last updated on 11 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.