0.1.0 • Published 4 years ago

react-native-stagger-animation v0.1.0

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

Battle Tested ✅ npm version npm Platform - Android and iOS License: MIT

➤ Installation

Add the dependency:

➤ Peer dependencies

  • Using animated-pose

➤ Usage

import StaggerAnimation, { Transition } from 'react-native-stagger-animation';

/**
 * Create stagger animation for header group
 */
const AnimatedStaggerHeader = StaggerAnimation.createAnimatedStagger();
const AnimatedViewHeader = StaggerAnimation.createAnimatedView({
  transitionType: 'easeInOut',
  duration: 900,
});

render() {
  // Visible state
  const { isVisible } = this.state;
  return (
    <Transition delayChildrenIn={150}>
      {isVisible && (
        <AnimatedStaggerHeader key="a">
          <AnimatedViewHeader>
            <Text>Hi Stephen</Text>
            <Image
              source={require('../assets/avatar.jpg')}
            />
          </AnimatedViewHeader>
          <AnimatedText>
            What sport are you going to play today ?
          </AnimatedText>
        </AnimatedStaggerHeader>
      )}
    </Transition>
  )
}

Note : The Transition is using to pass any props stagger animation

➤ Configuration

PropertyTypeDefaultDescription
createAnimatedStaggerfunction() => nullCreate the animate stagger wrapper view
createAnimatedViewfunction()=>nullCreate View animation component
createAnimatedTextfunction()=>nullCreate Text animation component

➤ Props

Transition type

  • spring,
  • linear,
  • easeIn, easeOut, easeInOut
  • circIn, circOut, circInOut
  • backIn, backOut, backInOut
  • anticipate

Animate Spring configuration

PropertyTypeDefaultDescription
typestringlinearCreate the animate stagger wrapper view
stiffness?number100Spring stiffness.
damping?number10Strength of opposing force.
velocity?number0Initial velocity.
overshootClamping?booleanfalseClamps any overshoot beyond the target value.
mass?number1Mass of the moving object.
useNativeDriverbooleanfalseUse native driver

Animate other transition type configuration

PropertyTypeDefaultDescription
typestringlinearCreate the animate stagger wrapper view
durationfunction300Total duration of animation, in milliseconds.
useNativeDriverbooleanfalseUse native driver

➤ Author

Sieu Thai, sieuhuflit@gmail.com

➤ License

React Native Gradient Header Library is available under the MIT license. See the LICENSE file for more info.