Transition component, analogous to React's ReactTransitionGroup, but in a more declarative style.
$ npm install vdux-transition
<Transition />
injects a special $transition
prop into all of its children. That prop has entering
, leaving
, didEnter
, and didLeave
. Example:
function Tooltip () {
return (
<Transition>
<InnerTooltip>{props.message}</InnerTooltip>
</Transition>
)
}
const InnerTooltip () {
render ({props}) {
const {$transition} = props
const {didEnter, didLeave, entering, leaving} = $transition
return (
<div class={{fade_in: entering, fade_out: leaving}} onAnimationEnd={[entering && didEnter, leaving && didLeave]}>
{children}
</div>
)
}
}
entering
- Whether or not the child is currently enteringleaving
- Whether or not the child is currently leavingdidEnter
- Call this when your enter animation finishesdidLeave
- Call this when your leave animation finishes
- CSSTransition - A higher-level transition component for animating classes, a la ReactCSSTransitionGroup/ngAnimate.
MIT