private _handleWillAnimate()

in src/web/listAnimations/AnimateListEdits.tsx [27:106]


    private _handleWillAnimate(edits: Edits, done: () => void) {
        let counter = 1;
        const animationCompleted = function() {
            --counter;
            if (counter === 0) {
                done();
            }
        };

        let delay = 0;
        if (edits.removed.length > 0 && this.props.animateChildLeave) {
            edits.removed.forEach(function(move) {
                try {
                    const domNode = ReactDOM.findDOMNode(move.element) as HTMLElement | null;
                    if (domNode) {
                        domNode.style.transform = 'translateY(' + -move.topDelta + 'px)';

                        counter++;
                        executeTransition(domNode, [{
                            property: 'opacity',
                            from: 1,
                            to: 0,
                            delay: delay,
                            duration: 150,
                            timing: 'linear',
                        }], animationCompleted);
                    }
                } catch {
                    // Exception probably due to race condition in unmounting. Ignore.
                }
            });
            delay += 75;
        }

        if (edits.moved.length > 0 && this.props.animateChildMove) {
            edits.moved.forEach(function(move) {
                counter++;

                try {
                    const domNode = ReactDOM.findDOMNode(move.element) as HTMLElement | null;
                    if (domNode) {
                        executeTransition(domNode, [{
                            property: 'transform',
                            from: 'translateY(' + -move.topDelta + 'px)',
                            to: '',
                            delay: delay,
                            duration: 300,
                            timing: 'ease-out',
                        }], animationCompleted);
                    }
                } catch {
                    // Exception probably due to race condition in unmounting. Ignore.
                }
            });
        }
        delay += 75;

        if (edits.added.length > 0 && this.props.animateChildEnter) {
            edits.added.forEach(function(move) {
                counter++;

                try {
                    const domNode = ReactDOM.findDOMNode(move.element) as HTMLElement | null;
                    if (domNode) {
                        executeTransition(domNode, [{
                            property: 'opacity',
                            from: 0,
                            to: 1,
                            delay: delay,
                            duration: 150,
                            timing: 'linear',
                        }], animationCompleted);
                    }
                } catch {
                    // Exception probably due to race condition in unmounting. Ignore.
                }
            });
        }
        animationCompleted();
    }