Vertical Step indicator
May 06, 2023
1 min
A simple and fully customizable React Native component that implements a progress stepper UI. Each steps content is displayed inside of a customizable ScrollView. Fully customizable buttons are displayed at the bottom of the component to move between steps.
npm i react-native-progress-steps
import React, { Component } from 'react'; import { View, Text } from 'react-native'; import { ProgressSteps, ProgressStep } from 'react-native-progress-steps'; class ExampleTwo extends Component { static navigationOptions = { header: null }; defaultScrollViewProps = { keyboardShouldPersistTaps: 'handled', contentContainerStyle: { flex: 1, justifyContent: 'center' } }; onNextStep = () => { console.log('called next step'); }; onPrevStep = () => { console.log('called previous step'); }; onSubmitSteps = () => { console.log('called on submit step.'); }; render() { const progressStepsStyle = { activeStepIconBorderColor: 'lightblue', activeLabelColor: 'black', activeStepNumColor: 'black', activeStepIconColor: 'lightblue', completedStepIconColor: 'lightgreen', completedProgressBarColor: 'lightgreen', completedCheckColor: 'green' }; const buttonTextStyle = { color: '#686868', fontWeight: 'bold' }; return ( <View style={{ flex: 1, marginTop: 50 }}> <ProgressSteps {...progressStepsStyle}> <ProgressStep label="First" onNext={this.onNextStep} onPrevious={this.onPrevStep} scrollViewProps={this.defaultScrollViewProps} nextBtnTextStyle={buttonTextStyle} previousBtnTextStyle={buttonTextStyle} > <View style={{ alignItems: 'center' }}> <Text>This is the content within step 1!</Text> </View> </ProgressStep> <ProgressStep label="Second" onNext={this.onNextStep} onPrevious={this.onPrevStep} scrollViewProps={this.defaultScrollViewProps} nextBtnTextStyle={buttonTextStyle} previousBtnTextStyle={buttonTextStyle} > <View style={{ alignItems: 'center' }}> <Text>This is the content within step 2!</Text> </View> </ProgressStep> <ProgressStep label="Third" onNext={this.onNextStep} onPrevious={this.onPrevStep} scrollViewProps={this.defaultScrollViewProps} nextBtnTextStyle={buttonTextStyle} previousBtnTextStyle={buttonTextStyle} > <View style={{ alignItems: 'center' }}> <Text>This is the content within step 3!</Text> </View> </ProgressStep> <ProgressStep label="Fourth" onNext={this.onNextStep} onPrevious={this.onPrevStep} scrollViewProps={this.defaultScrollViewProps} nextBtnTextStyle={buttonTextStyle} previousBtnTextStyle={buttonTextStyle} > <View style={{ alignItems: 'center' }}> <Text>This is the content within step 4!</Text> </View> </ProgressStep> <ProgressStep label="Fifth" onPrevious={this.onPrevStep} onSubmit={this.onSubmitSteps} scrollViewProps={this.defaultScrollViewProps} nextBtnTextStyle={buttonTextStyle} previousBtnTextStyle={buttonTextStyle} > <View style={{ alignItems: 'center' }}> <Text>This is the content within step 5!</Text> </View> </ProgressStep> </ProgressSteps> </View> ); } } export default ExampleTwo;
Quick Links
Legal Stuff