Git Product home page Git Product logo

react-native-cube-transition's Introduction

React Native Cube Transition

React Native module for iOS that rotates components on a cube, similar to Instagram Stories.

Installation

Install the module from npm.

npm install react-native-cube-transition --save

iOS

Link the framework in XCode.

  • Right click Libraries
  • Add Files to [Your Project's Name]
  • Go to node_modules/react-native-cube-transition
  • Add the .xcodeproj file
  • Add the libRNCubeTransition.a file under Libraries > RNCubeTransition.xcodeproj > Products to your project's Build Phases > Link Binary With Libraries

Android

Not supported, yet.

Usage

import React, { Component } from 'react';
import { Image, Dimensions, Text, StyleSheet, View } from 'react-native';
import { RNCubeTransition } from 'react-native-cube-transition';

export default class MyComponent extends Component {
  render() {
    return (
      <View style={styles.container}>
        <RNCubeTransition style={styles.page}>
          <View style={[styles.view, styles.view1]}>
            <Text style={styles.text}>3D Cube Transitions Using React Native</Text>
          </View>
          <Image
            source={require('./assets/test-1.jpg')}
            style={styles.image}
          />
          <View style={[styles.view, styles.view2]}>
            <Text style={styles.text}>Use View or Image components</Text>
          </View>
          <Image
            source={require('./assets/test-2.jpg')}
            style={styles.image}
          />
          <View style={[styles.view, styles.view2]}>
            <Text style={styles.text}>Even Gifs</Text>
          </View>
          <Image
            source={require('./assets/test-3.gif')}
            style={styles.image}
          />
        </RNCubeTransition>
      </View>
    );
  }
}

const { width, height } = Dimensions.get('window');
const styles = StyleSheet.create({
  container: {
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
    flex: 1,
  },
  page: {
    position: 'absolute',
    flexDirection: 'row',
    overflow: 'hidden',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0,
  },
  image: {
    resizeMode: 'stretch',
    width,
    height,
  },
  view: {
    justifyContent: 'center',
    alignItems: 'center',
    width,
    height,
  },
  text: {
    color: '#FFF',
    textAlign: 'center',
    fontSize: 30,
  },
});

License

MIT

react-native-cube-transition's People

Contributors

tlackemann avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.