Socket
Socket
Sign inDemoInstall

rn-card-swiper

Package Overview
Dependencies
519
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rn-card-swiper

A card swiper library using Reanimated 2


Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

React Native Card Swiper

A card swiper library using Reanimated 2

Preview

@screenshot-rn-card-swiper

Installation

npm install --save rn-card-swiper

or

yarn add rn-card-swiper

Dependencies

yarn add react-native-gesture-handler react-native-reanimated

Usage

import { CardSwiper } from 'rn-card-swiper';

// ...
const Data = [{ id: '1' }, { id: '2' }, { id: '3' }, { id: '4' }, { id: '5' }, { id: '6' }, { id: '7' }];

const _renderCard = (item: any) => {
    return (
      <View
        style={{
          flex: 1,
          alignItems: 'flex-end',
          justifyContent: 'flex-end',
        }}>
        <Text
          style={{
            fontSize: 400,
            fontWeight: 'bold',
            color: '#C7E2FF',
            right: -40,
            bottom: -20,
          }}>
          {item.id}
        </Text>
      </View>
    );
  };

const _renderEmptyMessage = () => {
    return (
      <View>
        <Text
          style={{
            fontSize: 28,
            fontWeight: 'bold',
            color: '#C7E2FF',
          }}
        >
          No more cards...
        </Text>
      </View>
    );
  };
// ...
<CardSwiper
  stackSize={5}
  cardsData={Data}
  renderCard={_renderCard}
  renderEmptyView={_renderEmptyMessage}
  cardStyle={
    {
      width: 300,
      height: 400,
      backgroundColor: 'white',
      borderColor: '#0095FF',
      borderWidth: 1,
    }
  }
  />;
// ...

Component props

proptypedefaultdescription
cardsDataarray[]array of data for the cards to be rendered
renderCardfuncrenders the card based on the data
renderEmptyViewfuncrenders the view to be shown after swiped last card
stackSizenumber5number of cards to be shown
startIndexnumber0initial card index
infinitebooleantruekeep swiping indefinitely
cardStyleobjectOoverride default card style
containerStyleobjectoverride default container style
offsetDirectionobject"Top"which way cards offsets will be shown
offsetSpacenumber8distance between cards
scaleRationumber0.8cards scale ratio in stack
disableLeftSwipebooleanfalsedisable left swipe
disableRightSwipebooleanfalsedisable right swipe
disableTopSwipebooleanfalsedisable top swipe
disableBottomSwipebooleanfalsedisable bottom swipe
disableSwipebooleanfalsedisable swipe in all directions
horizontalSwipebooleantrueswipe cards horizontally
verticalSwipebooleantrueswipe cards vertically
onlyTopSwipeablebooleanfalseonly top card can be swiped
cardElevatedbooleantrueputs shadows on card
touchInsetnumber10card's touch range from the edge
onSwipedAllfuncfunction to be called when the last card is swiped
onSwipedfuncfunction to be called when a card is swiped
onTapfuncfunction to be called when a card is tapped
onResetfuncfunction to be called when a card is released back to it's original position
onSwipedLeftfuncfunction to be called when a card swiped left
onSwipedRightfuncfunction to be called when a card is swiped right
onSwipedTopfuncfunction to be called when a card is swiped top
onSwipedBottomfuncfunction to be called when a card is swiped bottom

License

MIT

Keywords

FAQs

Last updated on 11 Nov 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc