chenglou / react-motion

A spring that solves your animation problems.
MIT License
21.7k stars 1.15k forks source link

ref is null #517

Open IronPans opened 6 years ago

IronPans commented 6 years ago
componentDidMount() {
        console.log(this.transitionEl);  // null
    }

componentWillReceiveProps(nextProps: PopoverProps) {
        console.log(this.transitionEl);  // null
    }

render() {

  return (<Motion defaultStyle={enterStyles} style={visible ? activeStyles : leaveStyles}>
                        {({opacity, scale}: any) => {
                            return (<div style={{
                                opacity: opacity,
                                transform: 'scale( ' + scale + ',' + scale + ')'
                            }} ref={node => {
                                this.transitionEl = node;
                            }}>
                                {children}
                            </div>);
                        }}
                    </Motion>);
}