Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

behnammodi/react-native-arrival

Repository files navigation

Animation when Component is mount

react-native-arrival

NPM

react-native-arrival

Left without react-native-arrival and right with react-native-arrival

Install

npm i react-native-arrival

Use

import React, { Component } from 'react';
import { Text, View } from 'react-native';
import Arrival from 'react-native-arrival';
class ScreenA extends Component {
 render() {
 return (
 <View style={{ flex: 1 }}>
 <Text>Screen A</Text>
 </View>
 );
 }
}
export default Arrival(ScreenA, {
 translateX: { from: 500, to: 0 },
 translateY: { from: 100, to: 0 },
 opacity: { from: 0, to: 1 }
});

More

You can use all tranform property:

p or perspective: number
r or rotate: string
rx or rotateX: string
ry or rotateY: string
rz or rotateZ: string
s or scale: number
sx or scaleX: number
sy or scaleY: number
x or translateX: number
y or translateY: number
skewX: string
skewY: string
opacity: number

Options

const ScreenA_ = Arrival(
 ScreenA,
 {
 translateX: { from: 500, to: 0 },
 translateY: { from: 100, to: 0 }
 },
 {
 toValue: 1,
 delay: 0,
 useNativeDriver: true
 }
);

Advance Options

You can change Arrival 'extends' from Component to PureComponent or other React Class

import React, { PureComponent } from 'react';
const ScreenA_ = Arrival(
 ScreenA,
 {
 scale: { from: 0, to: 1 }
 },
 {
 extends: PureComponent
 }
);

You can change Animated method from spring to timing and add method config

https://facebook.github.io/react-native/docs/animated#timing

import { Easing } from 'react-native';
const ScreenA_ = Arrival(
 ScreenA,
 {
 scale: { from: 0, to: 1 }
 },
 {
 method: 'timing',
 timing: {
 easing: Easing.linear,
 duration: 5000 // 5sec
 }
 }
);

Or change spring config

https://facebook.github.io/react-native/docs/animated#spring

import { Easing } from 'react-native';
const ScreenA_ = Arrival(
 ScreenA,
 {
 scale: { from: 0, to: 1 }
 },
 {
 spring: {
 friction: 7,
 tension: 40,
 speed: 12,
 bounciness: 8
 }
 }
);

About

Animation when Component is mount

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /