1.0.6 • Published 2 years ago

react-native-gesture-flip-card v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

react-native-gesture-flip-card

flip card animation using gesture for React Native

npm version

Installation

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

Simple Preview

App preview App preview

Minimal Usage

import GestureFlipView from 'react-native-gesture-flip-card';
<View style={styles.container}>
  <GestureFlipView width={300} height={500}>
    {renderBack()}
    {renderFront()}
    </GestureFlipView>
</View>

const renderFront = () => {
  return (
    <View style={styles.frontStyle}>
      <Text style={{fontSize: 25, color: '#fff'}}>{'Front'}</Text>
    </View>
  );
};

const renderBack = () => {
  return (
    <View style={styles.backStyle}>
      <Text style={{fontSize: 25, color: '#fff'}}>{'Back'}</Text>
    </View>
  );
};

Detail

Props

Propstypedescriptionrequireddefault
widthnumberwidth of viewtrue
heightnumberheight of viewtrue
onFlipEndfunctioncallback on end of flipfalse
perspectivenumberperspective of the viewfalse-1000
gestureEnabledboolenable or disable gesturesfalsetrue

Method

namedescriptionargs
flipLeftflip the card counterclockwise
flipRightflip the card clockwise
<GestureFlipView
  ref={(ref) => (viewRef.current = ref)}
  gestureEnabled={enable}
  width={300}
  height={500}>
  {renderBack()}
  {renderFront()} />
viewRef.current.flipLeft();  // counterclockwise
viewRef.current.flipRight(); // clockwise