0.1.4 • Published 1 year ago

react-native-stepper-ui-js v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-stepper-ui-js

Platform Version Download License

A simple and fully customizable React Native component to create stepper ui.

  • Work for android and IOS
  • Support typescript
  • Customizable

Table of contents

Example

Example OneExample TwoExample Three
npm.ionpm.ionpm.io

Installation

If using yarn:

yarn add react-native-stepper-ui-js

If using npm:

npm i react-native-stepper-ui-js

Usage

import React, { useState } from 'react';
import { Text, View } from 'react-native';

import Stepper from 'react-native-stepper-ui-js';

const MyComponent = (props) => {
  return (
    <View>
      <Text>{props.title}</Text>
    </View>
  );
};

const content = [
  <MyComponent title="Component 1" />,
  <MyComponent title="Component 2" />,
  <MyComponent title="Component 3" />,
];

const App = () => {
  const [active, setActive] = useState(0);

  return (
    <View style={{ marginVertical: 80, marginHorizontal: 20 }}>
      <Stepper
        active={active}
        content={content}
        onBack={() => setActive((p) => p - 1)}
        onFinish={() => alert('Finish')}
        onNext={() => setActive((p) => p + 1)}
      />
    </View>
  );
};

export default App;

Props

NameTypeDescriptionDefault
activenumberindex stepper activeundefined
contentReactElement[]Component that render to stepperundefined
onNextFunctionFunction called when the next step button is pressedundefined
onBackFunctionFunction called when the back step button is pressedundefined
onFinishFunctionFunction called when the finish step button is pressedundefined
wrapperStyle?ViewStyleWrapper component style{}
stepStyle?ViewStyleStep component style{backgroundColor: '#1976d2', width: 30, height: 30, borderRadius: 30, justifyContent: 'center', alignItems: 'center', opacity: 1}
stepTextStyle?TextStyleStep Text component style{color: 'white'}
buttonStyle?ViewStyleButton component style{ padding: 10, borderRadius: 4, alignSelf: 'flex-start', marginRight: 10, backgroundColor: '#a1a1a1'}
buttonTextStyle?TextStyleButton Text component style{color: 'white'}
showButton?booleanshow buttontrue
i18nobjectbutton lang{'back': 'Back','next': 'Next','finish': 'Finish'
iconsobjectbutton set icona{ "PENDING":"?", "SUCCESS": "&#10003", }
pendingStatebooleanenable pending icon on active steptrue
stepsIconsobjectstep icon default number{"1":1}