Skip to content

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

License

Notifications You must be signed in to change notification settings

cgarcia55/react-native-clean-number-input

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>
    );
  }
}

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%