1.3.0 • Published 5 years ago

react-native-steps v1.3.0

Weekly downloads
61
License
Apache-2.0
Repository
github
Last release
5 years ago

react-native-steps

A react-native implementation of step indicators widget.

Features

  • Can be used with ViewPager and Listview
  • Extremely Customizable
  • Supports vertical and horizontal orientation
  • Supports reversed mode
  • Supports animation between steps

Sample

$ cd sample
$ npm i // Or yarn install
$ react-native run-ios   // For ios
$ react-native run-android   // For Android

Installation

npm install react-native-steps --save

or

yarn add react-native-steps --save

Usage

import Steps from 'react-native-steps';

const labels = ["Cart","Delivery Address","Order Summary","Payment Method","Track"];
const configs = {
  stepIndicatorSize: 25,
  currentStepIndicatorSize:30,
  separatorStrokeWidth: 2,
  currentStepStrokeWidth: 3,
  stepStrokeCurrentColor: '#fe7013',
  stepStrokeWidth: 3,
  stepStrokeFinishedColor: '#fe7013',
  stepStrokeUnFinishedColor: '#aaaaaa',
  separatorFinishedColor: '#fe7013',
  separatorUnFinishedColor: '#aaaaaa',
  stepIndicatorFinishedColor: '#fe7013',
  stepIndicatorUnFinishedColor: '#ffffff',
  stepIndicatorCurrentColor: '#ffffff',
  stepIndicatorLabelFontSize: 13,
  currentStepIndicatorLabelFontSize: 13,
  stepIndicatorLabelCurrentColor: '#fe7013',
  stepIndicatorLabelFinishedColor: '#ffffff',
  stepIndicatorLabelUnFinishedColor: '#aaaaaa',
  labelColor: '#999999',
  labelSize: 13,
  currentStepLabelColor: '#fe7013'
};


constructor() {
    this.state = {
        current: 0
    }
}

render() {
  return (
    <Steps
         configs={configs}
         current={this.state.current}
         labels={labels}
    />
  )
}

onPageChange(position){
    this.setState({current: position});
}
//...

Props

NameTypeDescriptionDefault
currentNumberCurrent position in steps0
countNumberNumber of steps5
directionStringOrientation(i.e. horizontal,vertical)horizontal
configsObjectCustomization{}
labelsArrayLabels for each stepnull
reversedBooleanDirection of progressfalse
onPressFunction (position: Number)Function called when a step is pressednull
renderStepIndicatorFunction (position: Number, stepStatus: String)Use this to render custom content inside stepnull

Configs

NameTypeDefault
stepIndicatorSizeNumber30
currentStepIndicatorSizeNumber40
separatorStrokeWidthNumber3
separatorStrokeUnfinishedWidthNumber0
separatorStrokeFinishedWidthNumber0
stepStrokeWidthNumber0
currentStepStrokeWidthNumber5
stepStrokeCurrentColorString'#4aae4f'
stepStrokeFinishedColorString'#4aae4f'
stepStrokeUnFinishedColorString'#4aae4f'
separatorFinishedColorString'#4aae4f'
separatorUnFinishedColorString'#a4d4a5'
stepIndicatorFinishedColorString'#4aae4f'
stepIndicatorUnFinishedColorString'#a4d4a5'
stepIndicatorCurrentColorString'#ffffff'
stepIndicatorLabelFontSizeNumber15
currentStepIndicatorLabelFontSizeNumber15
stepIndicatorLabelCurrentColorString'#000000'
stepIndicatorLabelFinishedColorString'#ffffff'
stepIndicatorLabelUnFinishedColorString'rgba(255,255,255,0.5)'
labelColorString'#000000'
currentStepLabelColorString'#4aae4f'
labelSizeNumber13
labelAlignString'center'
labelStyleObject{}

License