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-increment-decrement-button

v1.0.0

Published

A simple component for numeric input with increment and decrement buttons

Downloads

17

Readme

React Native Increment Decrement Button

React Native Increment Decrement Button is a react-native component for add to cart like functionality.
It has following functionalities:
1.initial value support for button
2.max and min limit support.
3.Button disabling on max and min limit reach
4.Complete button disabling support. 5.Custom style support for both button and display text input.

Visiual example

GitHub Logo

Installation

if you have react-native-vector-icons and react-native-paper installed in your project.

yarn add react-native-increment-decrement-button

or with npm

npm install react-native-increment-decrement-button --save

if you don't have react-native-vector-icons and react-native-paper installed in your project

yarn add react-native-vector-icons react-native-paper react-native-increment-decrement-button

or with npm

npm install  react-native-vector-icons react-native-paper react-native-increment-decrement-button --save

if you're experiencing issues with react-native link which is used to install react-native-vector-icons please refer to react-native-vector-icons to see manual installation steps

Usage

import component

import RnIncrementDecrementBtn  from 
'react-native-increment-decrement-button';

Basic usage without any props

 <RnIncrementDecrementBtn  />

Adding val,minVal,max,minreq props

 <RnIncrementDecrementBtn minVal={0} minreq={3} max={10} val={3} />

Adding disableControl,disabledColor,activeColor props

 <RnIncrementDecrementBtn disableControl={false} disabledColor={'#eeeeee'} activeColor={'#509e4b'} /> 

Adding styles for button and textInput

<RnIncrementDecrementBtn
        styleBtn={{width:100,height:100}}
        styleTextInput={{width:100,height:100,backgroundColor:'green'}}
        labelStyle={{fontSize:25,color:'blue'}}
      />

Handling button click event

<RnIncrementDecrementBtn handleClick={()=>console.log('Pressed')}/>

Component with all props

<RnIncrementDecrementBtn
        minVal={0} 
        minreq={3} 
        max={10}
        val={3}
        disableControl={false}
        disabledColor={'#eeeeee'}
        activeColor={'#509e4b'}
        handleClick={()=>console.log('Pressed')}
        styleBtn={{width:100,height:100}}
        styleTextInput={{width:100,height:100,backgroundColor:'green'}}
        labelStyle={{fontSize:25,color:'blue'}}
      />

Props

Name | Type | Default -----|------|-------- val| number|0 minVal|number| 0 max|number|100 disableControl|boolean|none minreq|number|none handleClick|function| none styleTextInput|object| justifyContent: 'center',alignItems: 'center',fontSize: 18,borderWidth: 1, borderColor: '#eeeeee',height: PixelRatio.roundToNearestPixel((height * 5) / 100), width: PixelRatio.roundToNearestPixel((width * 8) / 100), styleBtn|object|justifyContent: 'center',alignItems: 'center', borderWidth: 1, borderColor: '#eeeeee', height: PixelRatio.roundToNearestPixel((height * 5) / 100), width: PixelRatio.roundToNearestPixel((width * 8) / 100), borderTopRightRadius: PixelRatio.roundToNearestPixel((height * 1) / 100), borderBottomRightRadius: PixelRatio.roundToNearestPixel((height * 1) / 100), disabledColor|string|#eeeeee activeColor|string|#509e4b labelStyle|object|fontSize:10

About props

  • val - value to be consider in the component state, if value is not given as a prop default 0 is taken.
  • minVal - minimun bound to decrement value.
  • max - maximum bound to which value to be incremented.
  • disableControl - prop to completely disable both buttons,useful incase of api calls.
  • minreq - minimum initial value to be present
  • handleClick(val) - function which takes value as param ,called when either button is clicked
  • styleTextInput - prop to apply custom style to view in which value is displayed
  • styleBtn - prop to apply custom style for buttons like width,height etc.
  • disabledColor - color to heighlight button disable when bound is reached
  • activeColor - color to showup buttons
  • labelStyle - prop to apply custom style for labels.It takes StyleProp such as fontSize,color etc.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT