Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-simple-stepper

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-simple-stepper

A super simple react-native implementation of the UIStepper from iOS.

  • 3.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38
decreased by-58.24%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-simple-stepper

Platform npm version npm version Build Status codecov License

A simple react-native implementation of the UIStepper control from iOS. To note, customization is available, see Props for more info.

Table of contents

Installation

  • yarn add react-native-simple-stepper
  • npm install react-native-simple-stepper --save

Usage

import React, { Component } from 'react';
import { SimpleStepper } from 'react-native-simple-stepper';

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = { value: 0 };
  }
  _valueChanged = value => {
    this.setState({ value });
  };
  render() {
    return <SimpleStepper valueChanged={value => this._valueChanged(value)} />;
  }
}

Using Text Position

First, set prop showText to true. Second, set prop textPosition to be left, center or right (default: center). Third, profit. It will render as a <Text/> component by default or you can override it with renderText prop. Example layouts:

LeftCenterRight
screenshotscreenshotscreenshot

Props

Values

NameTypeDescriptionDefault
initialValueNumberinitial value0
minimumValueNumberminimum value0
maximumValueNumbermaximum value10
stepValueNumberstep value (ex. increment by 10)1
incrementImageString or Numbernetwork or local imagerequire('./assets/increment.png')
decrementImageString or Numbernetwork or local imagerequire('./assets/decrement.png')
activeOpacityNumbertouch opacity0.4
disabledOpacityNumberwhen step button is disabled0.5
disabledBooleanstepper disable statefalse
wrapsBooleanwhether or not it wraps. more infofalse
showTextBooleanwhether or not to show text componentfalse
textPositionStringplacement of the text componentcenter

Functions

NameTypeDescriptionDefault
valueChangedFunctioninvoked when value changes() => {}
onMinFunctioninvoked when value reaches minimumValue() => {}
onMaxFunctioninvoked when value reaches maximumValue() => {}
onIncrementFunctioninvoked each time value increments() => {}
onDecrementFunctioninvoked each time value decrements() => {}
renderDecrementImageFunctionused to override decrement image componentundefined
renderIncrementImageFunctionused to override increment image componentundefined
renderDecrementStepFunctionused to override decrement step componentundefined
renderIncrementStepFunctionused to override increment step componentundefined
renderTextFunctionused to override text component when showText is true (defaults to Text/>)undefined

Styles

NameTypeDescriptionDefault
textStyleObjecttext component style{ padding: 8, fontSize: 20, fontWeight: 'bold', color: 'blue' }
containerStyleObjectcontainer component style{ backgroundColor: 'transparent', flexDirection: 'row', borderWidth: 2, borderRadius: 8, overflow: 'hidden', alignItems: 'center', borderColor: 'blue' }
separatorStyleObjectseparator component style{ width: StyleSheet.hairlineWidth, backgroundColor: 'blue', height: '100%' }
incrementStepStyleObjectincrement step component style{ padding: 8 }
decrementStepStyleObjectdecrement step component style{ padding: 8 }
incrementImageStyleObjectincrement image component styles{ height: 36, width: 36 }
decrementImageStyleObjectdecrement image component styles{ height: 36, width: 36 }

Keywords

FAQs

Package last updated on 16 Dec 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc