GithubHelp home page GithubHelp logo

tomkelsey / react-native-paper-onboarding Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gorhom/react-native-paper-onboarding

0.0 1.0 0.0 2.88 MB

Paper Onboarding is a material design UI slider for `React Native`.

License: MIT License

JavaScript 2.26% Java 7.57% TypeScript 85.27% Ruby 0.76% Objective-C 3.52% C 0.12% Swift 0.08% Handlebars 0.44%

react-native-paper-onboarding's Introduction

Paper Onboarding

npm npm npm

Paper Onboarding is a material design UI slider for React Native inspired by Ramotion Paper Onboarding.


Installation

yarn add @gorhom/paper-onboarding
# or
npm install @gorhom/paper-onboarding

Also, you need to install react-native-reanimated, react-native-gesture-handler & react-native-svg, and follow their installation instructions.

Usage

import PaperOnboarding, {PaperOnboardingItemType} from "@gorhom/paper-onboarding";

const data: PaperOnboardingItemType[] = [
  {
    title: 'Hotels',
    description: 'All hotels and hostels are sorted by hospitality rating',
    backgroundColor: '#698FB8',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
  {
    title: 'Banks',
    description: 'We carefully verify all banks before add them into the app',
    backgroundColor: '#6CB2B8',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
  {
    title: 'Stores',
    description: 'All local stores are categorized for your convenience',
    backgroundColor: '#9D8FBF',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
];

const Screen = () => {
  const handleOnClosePress = () => console.log('navigate to other screen')
  return (
    <PaperOnboarding
      data={data}
      onCloseButtonPress={handleOnClosePress}
    />
  )
}

Props

name description required type default
data Array of pages/slides to present. YES Array<PaperOnboardingItemType>
safeInsets Safe area insets usually come from react-native-safe-area-context. NO Insets {top: 50, bottom: 50, left: 50, right: 50}
direction Pan gesture direction. NO 'horizontal' | 'vertical' horizontal
indicatorSize Indicator size (width and height). NO number 40
indicatorBackgroundColor Indicator background color. NO string white
indicatorBorderColor Indicator border color. NO string white
titleStyle Text style to override all page/slide title style. NO StyleProp
descriptionStyle Text style to override all page/slide description style. NO StyleProp
closeButton Custom component to be used instead of the default close button. NO (() => React.ReactNode) | React.ReactNode
closeButtonText Close button text. NO string close
closeButtonTextStyle Close button text style. NO StyleProp
onCloseButtonPress Callback on close button pressed. NO () => void
onIndexChange Callback when index change. NO () => void

PaperOnboardingItemType

name description required type
content Slide/page content, this will replace default content. NO ((props: PageContentProps) => React.ReactNode) | React.ReactNode
image Image cover. NO (() => React.ReactNode) | React.ReactNode
icon Indicator icon. NO (() => React.ReactNode) | React.ReactNode
backgroundColor Background color. YES string
title Title text. NO string
description Description text. NO string
titleStyle Text style to override page/slide title default style. NO StyleProp
descriptionStyle Text style to override page/slide description default style. NO StyleProp
showCloseButton Show close button when page/slide is active, note: last page will always show close button. NO boolean

Methods

name description type
next Navigate to next page. () => void
previous Navigate to previous page. () => void

Built With ❤️

Author

License

MIT

Liked the library? 😇

Buy Me A Coffee


Mo Gorhom

react-native-paper-onboarding's People

Contributors

gorhom avatar benjeau avatar emadhajjar avatar bell-steven avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.