Pārlūkot izejas kodu

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 gadus atpakaļ
vecāks
revīzija
5cb4bec633

+ 11
- 4
react/features/base/label/components/CircularLabel.native.js Parādīt failu

@@ -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
     /**

Notiek ielāde…
Atcelt
Saglabāt