1.0.0 • Published 5 years ago

@rn-components-kit/deck-swiper v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

DeckSwiper

NPM version

English | 中文

Deck Swiper helps you evaluate one option at a time, instead of selecting from a set of options.

How to use

npm install @rn-components-kit/deck-swiper --save
PreviewCode
Demo1 Code

Props

Methods

Reference

Props

style

Allow you to customizr style

TypeRequiredDefault
objectno-

data

Data source of cards

TypeRequiredDefault
T[]yes-

cardWidth

Width of card (it is important to help calculate animation)

TypeRequiredDefault
numberyes-

cardHeight

Height of card (it is important to help calculate animation)

TypeRequiredDefault
numberyes-

renderCard

(params: {item: T, index: number}) => React.ReactElement | null

Takes an item from data and renders it into the swiper

TypeRequiredDefault
functionyes-

renderBottom

() => React.ReactElement | null

When all cards are swiped, it will be called and returns bottom layer component

TypeRequiredDefault
functionno-

onSwipeLeft

(from: number, to: number) => void

A callback will be triggered when card is swiped left

TypeRequiredDefault
functionno() => {}

onSwipeRight

(from: number, to: number) => void

A callback will be triggered when card is swiped right

TypeRequiredDefault
functionno() => {}

onBeginDragging

() => void

A callback will be triggered when you begin to drag DeckSwiper

TypeRequiredDefault
functionno() => {}

onEndDragging

() => void

A callback will be triggered when dragging operation ends

TypeRequiredDefault
functionno() => {}

Methods

prev

prev()

Swipes to previous card

next

next()

Swipes to next card