Socket
Book a DemoInstallSign in
Socket

@newagebel/react-native-card-flip

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@newagebel/react-native-card-flip

Card flip animation for React Native

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
5
Maintainers
4
Weekly downloads
 
Created
Source

react-native-card-flip

Card flip animation for React Native

contributions welcome npm version npm downloads

Installation

  npm install --save react-native-card-flip

Preview

App preview App preview2

import CardFlip from 'react-native-card-flip';
  <CardFlip style={styles.cardContainer} ref={(card) => this.card = card} >
    <TouchableOpacity style={styles.card} onPress={() => this.card.flip()} ><Text>AB</Text></TouchableOpacity>
    <TouchableOpacity style={styles.card} onPress={() => this.card.flip()} ><Text>CD</Text></TouchableOpacity>
  </CardFlip>

CardFlip

CardFlip props

Propstypedescriptionrequireddefault
styleobjectcontainer style{}
durationnumberflip duration1000
flipZoomnumberzoom level on flip0.09
flipDirectionstringthe rotation axis. 'x' or 'y''y'
perspectivenumber800

CardFlip events

Propstypedescription
onFlipfuncfunction to be called when a card is fliped. it receives the card-sides index
onFlipStartfuncfunction to be called when the flip-animation starts. it receives the card-sides index
onFlipEndfuncfunction to be called when the flip-animation ends. it receives the card-sides index

CardStack actions

Propstypedescriptionargsdefault
flipfuncFlips the card
tipfuncFlips the card{ direction, progress, duration }{ direction: 'left', progress: 0.05, duration: 150 }
jigglefuncJiggles the card{ count, duration, progress }{ count: 2, duration: 200, progress: 0.05 }

jiggle

App jiggle

<CardFlip style={styles.cardContainer} ref={(card) => this.card = card} >
  <TouchableOpacity style={styles.card} onPress={() => this.card.jiggle({ count: 2, duration: 100, progress: 0.05 })} ><Text>AB</Text></TouchableOpacity>
  <TouchableOpacity style={styles.card} onPress={() => this.card.flip()} ><Text>CD</Text></TouchableOpacity>
</CardFlip>

tip

App tip

<CardFlip style={styles.cardContainer} ref={(card) => this.card = card} >
  <TouchableOpacity style={styles.card} onPress={() => this.card.tip({ direction: 'right', duration: 150 })} ><Text>AB</Text></TouchableOpacity>
  <TouchableOpacity style={styles.card} onPress={() => this.card.flip()} ><Text>CD</Text></TouchableOpacity>
</CardFlip>

CardFlip in map

{cards.map((item, index) => {
  return (
    <CardFlip style={ styles.cardContainer } ref={ (card) => this['card' + index] = card } >
      <TouchableOpacity style={ styles.card } onPress={() => this['card' + index].flip()} ><Text>{item}</Text></TouchableOpacity>
      <TouchableOpacity style={ styles.card } onPress={() => this['card' + index].flip()} ><Text>{item}</Text></TouchableOpacity>
    </CardFlip>
  )
})}

Keywords

react-native

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

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