0.2.1 • Published 7 years ago

react-native-js-stepper v0.2.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

react-native-js-stepper

React Native component to display a Stepper, a sequence of logical and numbered steps, frequently used for navigation.

See more on:

https://material.io/guidelines/components/steppers.html

Getting started

$ yarn add react-native-js-stepper

Usage

/* @flow */

import React from 'react'
import { StyleSheet } from 'react-native'
import Stepper from 'react-native-js-stepper'

type Props = {}

export default class ViewScreen extends React.Component<Props> {
  render() {
    return (
      <Stepper
        ref={(ref: any) => {
          this.stepper = ref
        }}
        validation={false}
        activeDotStyle={styles.activeDot}
        inactiveDotStyle={styles.inactiveDot}
        showTopStepper={true}
        showBottomStepper={true}
        steps={['Step 1', 'Step 2']}
        backButtonTitle="BACK"
        nextButtonTitle="NEXT"
        activeStepStyle={styles.activeStep}
        inactiveStepStyle={styles.inactiveStep}
        activeStepTitleStyle={styles.activeStepTitle}
        inactiveStepTitleStyle={styles.inactiveStepTitle}
        activeStepNumberStyle={styles.activeStepNumber}
        inactiveStepNumberStyle={styles.inactiveStepNumber}>
        <View />
        <View />
      </Stepper>
    )
  }
}

const styles = StyleSheet.create({
  activeDot: {
    backgroundColor: 'grey'
  },
  inactiveDot: {
    backgroundColor: '#ededed'
  },
  activeStep: {
    backgroundColor: 'grey'
  },
  inactiveStep: {
    backgroundColor: '#ededed'
  },
  activeStepTitle: {
    fontWeight: 'bold'
  },
  inactiveStepTitle: {
    fontWeight: 'normal'
  },
  activeStepNumber: {
    color: 'white'
  },
  inactiveStepNumber: {
    color: 'black'
  }
})

API

PropsTypeDescriptionRequired
initialPagenumberIndex of initial page that should be selectedNo
onPressNextFunctionFunction executed when Next button is pressed at the bottomNo
onPressBackFunctionFunction executed when Back button is pressed at the bottomNo
onScrollPageFunctionFunction executed when page is changed by scroll eventNo
textButtonStyleObjectText styles of the Back and Next buttons at the bottomNo
backButtonTitlestringTitle of the Back buttonNo
nextButtonTitlestringTitle of the Next buttonNo
topStepperStyleObjectStyles of the top stepperNo
showTopStepperbooleanIf true shows the top stepperNo
activeDotStyleObjectStyles object of active dot at the bottomNo
inactiveDotStyleObjectStyles object of inactive dot at the bottomNo
stepsArrayArray of strings that contains title of each step on the top stepperNo
stepsTitleStyleObjectStyles object for title of each step at topNo
showBottomStepperbooleanIf true shows bottom stepperNo
activeStepNumberStyleObjectStyles object of number on active stepNo
inactiveStepNumberStyleObjectStyles object of number on inactive stepNo
activeStepTitleStyleObjectStyles object of title on active stepNo
inactiveStepTitleStyleObjectStyles object of title on inactive stepNo
validationbooleanDisables validation (related to top stepper numbers)No

License

MIT License

Copyright (c) 2018 InterfaceKit

Author

Antonio Moreno Valls <amoreno at apsl.net>

Built with 💛 by APSL.