ref(circular-label): animate after dom updates

Based on react-native docs, looks like animations should be
started after mount. Updating animation states I'm not certain
on so I moved it to componentDidUpdate and tested with the
live streaming label to ensure the component still animated fine.
This commit is contained in:
Leonard Kim 2018-11-02 14:48:03 -07:00 committed by Leonard Kim
parent 4409bbabb7
commit 5cb4bec633
1 changed files with 12 additions and 5 deletions

View File

@ -64,17 +64,24 @@ export default class CircularLabel extends AbstractCircularLabel<Props, State> {
this.state = { this.state = {
pulseAnimation: new Animated.Value(0) pulseAnimation: new Animated.Value(0)
}; };
this._maybeToggleAnimation({}, props);
} }
/** /**
* Implements {@code Component#componentWillReceiveProps}. * Implements {@code Component#componentDidMount}.
* *
* @inheritdoc * @inheritdoc
*/ */
componentWillReceiveProps(newProps: Props) { componentDidMount() {
this._maybeToggleAnimation(this.props, newProps); this._maybeToggleAnimation({}, this.props);
}
/**
* Implements {@code Component#componentDidUpdate}.
*
* @inheritdoc
*/
componentDidUpdate(prevProps: Props) {
this._maybeToggleAnimation(prevProps, this.props);
} }
/** /**