• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

gorhom/react-native-paper-onboarding: Paper Onboarding is a material design UI s ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

gorhom/react-native-paper-onboarding

开源软件地址(OpenSource Url):

https://github.com/gorhom/react-native-paper-onboarding

开源编程语言(OpenSource Language):

TypeScript 85.2%

开源软件介绍(OpenSource 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

Author

Sponsor & Support

To keep this library maintained and up-to-date please consider sponsoring it on GitHub. Or if you are looking for a private support or help in customizing the experience, then reach out to me on Twitter @gorhom.

License

MIT

Built With ❤️


Mo Gorhom




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
fireflight1/mcg: Material Design Color Generator发布时间:2022-08-17
下一篇:
prograd-org/lab-angular-material-design-forms发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap