1.0.1 • Published 4 years ago

@sumitlubal/react-native-flippable-card v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-native-flip-component

Installation

npm install @sumitlubal/react-native-flippable-card --save

Instructions

Pass a boolean, front component, and back component as props. The boolean will determine if the front or back component should be displayed.

Demo

To see the code from this GIF, check out example.js in the repo on GitHub. npm.io

Props

NameRequired?Description
isFlippedtrueBoolean that controls if the view is flipped.
frontViewtrueComponent for the front view.
backViewtrueComponent for the back view.
scalefalseControls if the view zooms in or out while flipping. Defaults to 0.8
scaleDurationfalseControls how quickly the scale changes. Defaults to 100
frontPerspectivefalseControls the perception of depth for the front component. Defaults to 1000
backPerspectivefalseControls the perception of depth for the back component. Defaults to 1000
rotateDurationfalseControls the duration of the rotation. Defaults to 300
containerStylesfalseStyles for the flip-component's container <View>. Defaults to null
frontStylesfalseStyles for the <Animated.View> that wraps the front component. Defaults to null
backStylesfalseStyles for the <Animated.View> that wraps the back component. Defaults to null

Example

import React, { Component } from 'react';
import FlipComponent from 'react-native-flip-component';
import { View, Button, Text } from 'react-native';

class Example extends Component {
  constructor(props) {
    super(props);
    this.state = {
      isFlipped: false;
    };
  }
  render() {
    <View>
      <FlipComponent
        isFlipped={this.state.isFlipped}
        frontView={
          <View>
            <Text style={{ textAlign: 'center' }}>
              Front Side
            </Text>
          </View>
        }
        backView={
          <View>
            <Text style={{ textAlign: 'center' }}>
              Back Side
            </Text>
          </View>
        }
      />
      <Button
        onPress={() => {
          this.setState({ isFlipped: !this.state.isFlipped })
        }}
        title="Flip"
      />
    </View>
  }
}

This library is just mere extension of https://github.com/plmok61/react-native-flip-component