Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.28 KB

README.md

File metadata and controls

51 lines (39 loc) · 1.28 KB

React Native Clean Number Input

React Native Component that removes all non-numeric characters from user input.

demo

Installation

npm install react-native-clean-number-input

Usage

Just import the NumberInput Component and render it. When the value of the input changes all non-numeric characters will removed.

import NumberInput from 'react-native-clean-number-input';

class App extends React.Component {
  render() {
    return (
      <View>
        <NumberInput value={20} />
      </View>
    );
  }
}

Props

The NumberInput Component can accept any prop that TextInput accept, but the prop value is required. To customize the TextInput that is rendered inside the NumberInput Component, simply pass props the TextInput accepts to the NumberInput Component. You can find the props the TextInput Component accepts here.

Here is an example of how to change the keyboard type to numeric.

import NumberInput from 'react-native-valid-number-input';

class App extends React.Component {
  render() {
    return (
      <View>
        <NumberInput
          value={20}
          keyboardType={'numeric'}
        />
      </View>
    );
  }
}