# react-delegate-transition-group

> Low-level API for custom animations

Latest version **16.0.0** (published 2017-11-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-delegate-transition-group
pnpm add react-delegate-transition-group
yarn add react-delegate-transition-group
bun add react-delegate-transition-group
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 16.0.0 |
| Published | 2017-11-07 |
| First published | 2016-11-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Thomas Heymann |
| Maintainers | cyberthom |

## Links

- npm: https://www.npmjs.com/package/react-delegate-transition-group
- Repository: https://github.com/cyberthom/react-delegate-transition-group
- Homepage: https://github.com/cyberthom/react-delegate-transition-group#readme
- Issues: https://github.com/cyberthom/react-delegate-transition-group/issues
- npm.io page: https://npm.io/package/react-delegate-transition-group

## Dependencies (2)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.0
- [react-transition-group](https://npm.io/package/react-transition-group.md) ^1.1.2

## Recent versions

- 16.0.0 (latest) — 2017-11-07
- 15.5.0 — 2017-04-25
- 15.5.0-alpha.1 — 2017-04-25
- 0.14.3 — 2016-11-14
- 0.14.2 — 2016-11-14
- 0.14.1 — 2016-11-12
- 0.14.0 — 2016-11-12

## README

# React Delegate Transition Group

Low-level API for custom animations.

Essentially the same as [react-transition-group](https://github.com/reactjs/react-transition-group) except that lifecycle hooks (called when children are added or removed) are handled by the parent component rather than its children.


## Installation

```
npm install --save react-delegate-transition-group
```


## Usage

```JavaScript
import DelegateTransitionGroup from 'react-delegate-transition-group';
import { createElement } from 'react';
import { findDOMNode } from 'react-dom';

class ExampleAnimation extends Component {
    childWillEnter = (component, callback) => {
        const parent = findDOMNode(this);
        const child = findDOMNode(component);
        const { height } = child.getBoundingClientRect();
        parent.style.height = `${height}px`;
        setTimeout(callback, 400);
    }

    render() {
        return createElement(DelegateTransitionGroup, { ...this.props, onEnter: this.childWillEnter });
    }
}

export default ExampleAnimation;
```

For example implementations see:

* [react-slide-animation](https://github.com/cyberthom/react-slide-animation)
* [react-swap-animation](https://github.com/cyberthom/react-swap-animation)


## Reference

* `onAppear(component, callback)` - Called at the same time as componentDidMount() for components that are initially mounted in a DelegateTransitionGroup. 

    It will block other animations from occurring until callback is called. It is only called on the initial render of a DelegateTransitionGroup

* `onEnter(component, callback)` - Called at the same time as componentDidMount() for components added to an existing DelegateTransitionGroup. 

    It will block other animations from occurring until callback is called. It will not be called on the initial render of a TransitionGroup.

* `onLeave(component, callback)` - Called when the child has been removed from the DelegateTransitionGroup. 

    Though the child has been removed, DelegateTransitionGroup will keep it in the DOM until callback is called.

---
_Source: https://npm.io/package/react-delegate-transition-group · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
