You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-flip-component

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-flip-component

Double-sided React component that flips 180 degrees

1.0.6
latest
Source
npm
Version published
Weekly downloads
15
-31.82%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-flip-component

Installation

npm install react-native-flip-component --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.

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>
  }
}

Keywords

react-native

FAQs

Package last updated on 22 Jan 2019

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