react-native-flip-card
The card component which have motion of flip for React Native(iOS/Android)
Demo
Installation
in Cli
npm i react-native-flip-card
Usage
Simple
import FlipCard from 'react-native-flip-card'
<FlipCard>
{/* Face Side */}
<View style={styles.face}>
<Text>The Face</Text>
</View>
{/* Back Side */}
<View style={styles.back}>
<Text>The Back</Text>
</View>
</FlipCard>
Customized
<FlipCard
style={styles.card}
friction={6}
perspective={1000}
flipHorizontal={true}
flipVertical={false}
flip={false}
clickable={true}
onFlipped={(isFlipped)=>{console.log('isFlipped', isFlipped)}}
>
{/* Face Side */}
<View style={styles.face}>
<Text>The Face</Text>
</View>
{/* Back Side */}
<View style={styles.back}>
<Text>The Back</Text>
</View>
</FlipCard>
Props
Default: false
flip(bool) If you change default display side, you can set true
to this param. If you change side, you can pass bool
variable dynamically.
Default: true
clicakble(bool) If you want to disable click a card, you can set false
to this param.
Default: 6
friction(number) The friction of card animation
Default: 0
perspective(number) The amount of perspective applied to the flip transformation
Default: false
flipHorizontal(bool) If you set true, a card flip to horizontal.
Default: true
flipVertical(bool) If you set false, a card not flip to vertical. If you set true both flipHorizontal
and flipVertical
, a card flip to diagonal.
vertical | diagnoal |
---|---|
(is_flipped) => {}
onFlipped(function) When a card finish a flip animation, call onFlipped
function with param.
Default:false
alignHeight(boolean) If you pass true
to alignHeight
param, the card keep height of bigger side.
Default:false
alignWidth(boolean) If you pass true
to alignWidth
param, the card keep width of bigger side.
Credits
Inspired by react-flipcard
License
MIT