1.0.1 • Published 6 years ago

react-animate-mount v1.0.1

Weekly downloads
264
License
MIT
Repository
github
Last release
6 years ago

React Animate Mount

npm version license

Simple and light wrapper component for sliding (to auto height) and fading animation when children mounts and unmount:

  • Animate - provides animation for single component when mount & umount
  • AnimateGroup - provides animation for items entering & leaving a list.

Install

$ yarn add react-animate-mount

Demos

Animate

Help animate single component when mount & umount

Usage

/** Before **/
this.state.show ? {childen} : null;

/** After **/
import { Animate } from 'react-animate-mount'

<Animate show={this.state.show}>
  {childen}
</Animate>

Props

NameTypeDescription
showbooleanThe key boolean that indicate if the children should be mounted
appear?boolean = falseNormally component is not animated when <Animate> mounts, with this flag the child component will animate in on initialization.
duration?number = 200The duration you want the animate to last in ms, default to 250
type?string('slide' or 'fade') = 'slide'Specify animation effect, sliding or pure fading
onAnimateComplete?functionInvokes when component animation finishes.

AnimateGroup

Wraps around a list of item, this provides <Animate> effect to each individual child. As item changes in the list, <AnimateGroup> will animate out removed children and animate in new children correctly.

Please provide unique key to each child. keys are used to identify child between renders

Usage

import { AnimateGroup } from 'react-animate-mount'

<AnimateGroup>
  {items.map(item => (<Item key={item.key} data={item.data} />)}
</AnimateGroup>

Props

NameTypeDescription
duration?number = 200The duration you want the animate to last in ms, default to 250
type?string('slide' or 'fade') = 'slide'Specify animation effect, sliding or pure fading
onAnimateComplete?functionInvokes when each time animation finishes.
1.0.1

6 years ago

1.0.0

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago