浏览代码

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.
master
Leonard Kim 6 年前
父节点
当前提交
5cb4bec633
共有 1 个文件被更改,包括 11 次插入4 次删除
  1. 11
    4
      react/features/base/label/components/CircularLabel.native.js

+ 11
- 4
react/features/base/label/components/CircularLabel.native.js 查看文件

@@ -64,17 +64,24 @@ export default class CircularLabel extends AbstractCircularLabel<Props, State> {
64 64
         this.state = {
65 65
             pulseAnimation: new Animated.Value(0)
66 66
         };
67
+    }
67 68
 
68
-        this._maybeToggleAnimation({}, props);
69
+    /**
70
+     * Implements {@code Component#componentDidMount}.
71
+     *
72
+     * @inheritdoc
73
+     */
74
+    componentDidMount() {
75
+        this._maybeToggleAnimation({}, this.props);
69 76
     }
70 77
 
71 78
     /**
72
-     * Implements {@code Component#componentWillReceiveProps}.
79
+     * Implements {@code Component#componentDidUpdate}.
73 80
      *
74 81
      * @inheritdoc
75 82
      */
76
-    componentWillReceiveProps(newProps: Props) {
77
-        this._maybeToggleAnimation(this.props, newProps);
83
+    componentDidUpdate(prevProps: Props) {
84
+        this._maybeToggleAnimation(prevProps, this.props);
78 85
     }
79 86
 
80 87
     /**

正在加载...
取消
保存