npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-numeric-input-pure-js

v2.0.0

Published

a stylish numeric input for react native

Downloads

56

Readme

react-native-numeric-input-pure-js

a cross platform stylish numeric input for react native

Working example

you can check out the very simple react native example app just click here and follow the instructions enjoy!

Installation

yarn add react-native-numeric-input-pure-js

or with npm

npm install react-native-numeric-input-pure-js --save

link to npm page

Responsive default size

this component uses the react-native-pixel-perfect

and the default style is using base resolution for iphone7, in case you want to use the default design but, using a different base resolution, I added a function called updateBaseResolution(width,height) to use it you need to access it via a ref to the component.

since the component is dependant on react-native-pixel-perfect, when installing this package you install also react-native-pixel-perfect if it's not already installed.

so you can create your own responsive size function and use it to set your custom style.

Usage

import Component

import NumericInput from 'react-native-numeric-input-pure-js'

Basic Usage

<NumericInput onChange={value => console.log(value)} />

or basic up-down

<NumericInput type='up-down' onChange={value => console.log(value)} />

Keep State Value

<NumericInput value={this.state.value} onChange={value => this.setState({value})} />

Advanced Usage

        <NumericInput
            value={this.state.value}
            onChange={value => this.setState({value})}
            onLimitReached={(isMax,msg) => console.log(isMax,msg)}
            totalWidth={240}
            totalHeight={50}
            iconColor='white'
            step={1.5}
            valueType='real'
            rounded
            textColor='#B0228C'
            // iconStyle={{ color: 'white' }}
            rightButtonBackgroundColor='#EA3788'
            leftButtonBackgroundColor='#E56B70'/>

Props

Name | Type | Default ------------------------------------|-------------------------------------|:-------: value |number | none minValue |number | none maxValue |number | none step |number | 1 valueType |'integer' or 'real' | 'integer' initValue |number | null if not used will start at 0 iconColor |string | 'black' borderColor |string | '#d4d4d4' iconStyle |object | none totalWidth |number | calcSize(220) separatorWidth |number | 1 type |'plus-minus' or 'up-down' | 'plus-minus' rounded |boolean | false textColor |string | 'black' containerStyle |object | none inputStyle |object | none upDownButtonsBackgroundColor |string | 'white' rightButtonBackgroundColor |string | 'white' leftButtonBackgroundColor |string | 'white' totalHeight |number | none onChange |function | none - required prop onLimitReached |function | none (empty function) editable |boolean | true validateOnBlur |boolean | true reachMaxIncIconStyle |object | none reachMaxDecIconStyle |object | none reachMinIncIconStyle |object | none reachMinDecIconStyle |object | none extraTextInputProps |object | none

notes about props

  • value prop - this component uses it's own state to hold value if value is not given as a prop
  • style props - this component has a default style and the styles props are to override the default style or add more fields
  • totalWidth prop - this prop is for the entire component width, and all other sizes are derived from it , unless given other size props
  • initValue prop - if using value prop, this is not needed and the initial value can be given by the value prop
  • validateOnBlur - added on version 1.3.2, if set to false the text input will validate while typing, not recommended, so just keep it true unless there is a good reason not to use the default functionallity
  • reachMaxIncIconStyle - added on version 1.4.0, used to set style to the increment button icon in case maxValue is reached - optional
  • reachMaxDecIconStyle - added on version 1.4.0, used to set style to the decrement button icon in case maxValue is reached - optional
  • reachMinIncIconStyle - added on version 1.4.0, used to set style to the increment button icon in case minValue is reached - optional
  • reachMinDecIconStyle - added on version 1.4.0, used to set style to the decrement button icon in case minValue is reached - optional
  • onLimitReached - added on version 1.7.0, used to handle event of min/max reached, this function receives 2 arguments: (isMas:Boolean, msg:String) like in the advanced example above - optional
  • extraTextInputProps - added on version 1.8.0, used to add props used for the original TextInput component that are not used/supported in this component explicitly - optional

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License