1.3.1 • Published 2 years ago

@eccocar/wizard-component v1.3.1

Weekly downloads
-
License
BSD-3-Clause
Repository
bitbucket
Last release
2 years ago

Eccocar - Wizard Component

React native component for wizard.

Powered by Eccocar

Install

Install @eccocar/wizard-component package and save into package.json:

NPM

$ npm install @eccocar/wizard-component --save

Yarn

$ yarn add @eccocar/wizard-component

How to use?

import React from 'react'
import Wizard from '@eccocar/wizard-component'

export default class App extends React.Component {

  render() {

    // Define the pages, it will be displayed in order
    let pages = [
      {
        backgroundColor: '#fff',
        image: <Image source={ require('assets/circle.png') } />,
        subtitle: 'Done with React Native Wizard Component',
        title: 'Welcome',
      }, {
        backgroundColor: '#fe6e58',
        image: <Image source={ require('assets/square.png') } />,
        subtitle: 'This is the subtitle that sumplements the title.',
        title: 'The Title',
      }, {
        backgroundColor: '#999',
        image: <Image source={ require('assets/triangle.png') } />,
        subtitle: 'Beautiful, isn\'t it?',
        title: 'Triangle',
      }
    ]

    return (
      <Wizard
        pages={ pages }
        onDone={ () => this.props.navigation.navigate('RouteName') }
      />
    )
  }
}

Properties

NameTypeDefault ValueDefinition
bottomBarHeight (optional)number60A number for the height of the bottom bar
bottomBarHighlight (optional)booleantrueA bool flag indicating whether the bottom bar should be highlighted
containerStyles (optional)object { ...styles }-Override the default container styles
controlStatusBar (optional)booleantrueA bool flag indicating whether the status bar should change with the background color
defaultPages (optional)booleanfalseUse 3 pages generated by default
imageContainerStyles (optional)object { ...styles }-Override the default image container styles
nextLabel (optional)string / ElementNextA string or a React-Native component for the Next label
onDonefunction-A callback that is fired after the OnBoarding is completed
onSkip (optional)function-A callback that is fired if the OnBoarding is skipped
pagesarray of object { pagesProperties }-A array of pages to show in the component. Show below pagesProperties
pageIndexCallback (optional)function(indexPage: number)-A function that receives the page index as a parameter on page change
skipLabel (optional)string / ElementSkipA string OR a React-Native component for the Skip label
skipToPage (optional)number-When pressing skip, go to that page (ex. skipToPage={2}). If this prop is provided, ignores onSkip
subtitleStyles (optional)object { ...styles }-Override the default subtitle styles
titleStyles (optional)object { ...styles }-Override the default title styles
transitionAnimationDuration (optional)number500The duration in milliseconds for the animation of the background color for the page transition

Pages properties

NameTypeDefault ValueDefinition
backgroundColorstring(hex,rgb,etc)-A background color. The color of the font and dots adapts to the background color
imageElement-A React-Native component to display at the top of the page
titlestring / Element-A string OR a React-Native component
titleStyles (optional)object { ...styles }-Modify styles of a specific page's title
subtitlestring / Element-A string OR a React-Native component
subtitleStyles (optional)object { ...styles }-Modify styles of a specific page's subtitle

Todo

  • Test on Android & iOS
  • Improve and add new features
  • Add more styles
  • Create tests
  • Add new props and components in readme

Version 1.3.1 (Changelog)