🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-native-transition-view-async

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-transition-view-async

This transition view allows preparation of components before rendering animation. Suitable for showing animations for asynchronous presentation.

0.0.1
Source
npm
Version published
Maintainers
1
Created
Source

react-native-transition-view-async

This transition view allows preparation of components before rendering animation. Suitable for showing animations for asynchronous presentation.

npm version NPM

Demo

Demo Showcase

Demo Showcase

Prerequisites

React Native 0.25 or higher

Installation

npm i react-native-transition-view-async --save

Usage

1. Bootstrap Transition View

import {
  TransitionView,
  FadeTransitionChildView,
  ShowcaseTransitionChildView,
  SlowEnlargeTransitionChildView,
} from 'react-native-transition-view-async'

[...]

render()
{
  return (
    <View style={{flexDirection: 'row', flex: 1}}>
      <TransitionView
        ref={(v) => {this.transitionView = v;}}
        style={{flex: 1}}>
      </TransitionView>
    </View>
  )
}

2. Enqueue View & Consume View

"Enqueue" pushes new component into queue. Transition does not take place yet.

this.transitionView.enqueue(<View ... />, {OPTIONS})

Running "consume()" function triggers the following transitions: a. Fading out of current component b. Fading in of the next component in queue

this.transitionView.consume()

Options Table

KeyTypeValue(s)Mandatory?
SpecificTransitionChildViewReact Component ClassAny inheritance of TransitionChildView: TransitionChildView, FadeTransitionChildView, ShowcaseTransitionChildView, SlowEnlargeTransitionChildViewNo (Default: TransitionChildView)

3. Use case: Screensaver

const SpecificTransitionChildView = SlowEnlargeTransitionChildView;
this.transitionView.enqueue((
    <View style={{flex: 1, flexDirection: 'row'}}>
        <Image style={{flex: 1, alignSelf: 'stretch', resizeMode: 'stretch'}}
            source={{uri: `https://picsum.photos/2000/2000&t=${new Date().getTime()}`}}
            onLoad={() => {
            
                this.transitionView.consume();
                
                setTimeout(() => {
                    this.onChange();
                }, 3000);
            }}
        />
    </View>
), {
    SpecificTransitionChildView: SpecificTransitionChildView,
});

4. Custom Transitions

All the custom transition components should inherit <TransitionChildView>. To understand how the transition animations are made, refer to our transition examples:

Keywords

react

FAQs

Package last updated on 09 Mar 2018

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