File tree 11 files changed +39
-40
lines changed
11 files changed +39
-40
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ class AnimatedNumber extends React.PureComponent {
39
39
} ) ;
40
40
}
41
41
}
42
- componentWillReceiveProps ( nextProps ) {
42
+ componentDidUpdate ( prevProps ) {
43
43
const { value } = this . props ;
44
44
45
- if ( value !== nextProps . value ) {
46
- this . move ( nextProps ) ;
45
+ if ( prevProps . value !== value ) {
46
+ this . move ( this . props ) ;
47
47
}
48
48
}
49
49
onValueChanged = e => {
Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ class AnimatedText extends React.PureComponent {
28
28
originLength : value . length ,
29
29
} ;
30
30
}
31
- componentWillReceiveProps ( nextProps ) {
31
+ componentDidUpdate ( prevProps ) {
32
32
const { value } = this . props ;
33
33
34
- if ( value !== nextProps . value ) {
35
- this . change ( nextProps ) ;
34
+ if ( prevProps . value !== value ) {
35
+ this . change ( this . props ) ;
36
36
}
37
37
}
38
38
onValueChanged = e => {
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ class Opacity extends PureComponent {
19
19
opacityValue : new Animated . Value ( value ) ,
20
20
} ;
21
21
}
22
- componentWillReceiveProps ( nextProps ) {
22
+ componentDidUpdate ( prevProps ) {
23
23
const { value } = this . props ;
24
24
25
- if ( value !== nextProps . value ) {
26
- this . move ( nextProps ) ;
25
+ if ( prevProps . value !== value ) {
26
+ this . move ( this . props ) ;
27
27
}
28
28
}
29
29
move = props => {
Original file line number Diff line number Diff line change @@ -34,21 +34,21 @@ class Scale extends PureComponent {
34
34
} ) ;
35
35
}
36
36
}
37
- componentWillReceiveProps ( nextProps ) {
38
- const { value } = this . props ;
37
+ componentDidUpdate ( prevProps ) {
38
+ const { value, runAfterInteractions } = this . props ;
39
39
40
- if ( value !== nextProps . value ) {
40
+ if ( prevProps . value !== value ) {
41
41
if ( this . interaction ) {
42
42
this . interaction . cancel ( ) ;
43
43
}
44
44
45
- if ( nextProps . runAfterInteractions ) {
45
+ if ( runAfterInteractions ) {
46
46
this . interaction = InteractionManager . runAfterInteractions ( ( ) => {
47
47
this . interaction = null ;
48
- this . move ( nextProps ) ;
48
+ this . move ( this . props ) ;
49
49
} ) ;
50
50
} else {
51
- this . move ( nextProps ) ;
51
+ this . move ( this . props ) ;
52
52
}
53
53
}
54
54
}
Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ class ScaleAndOpacity extends PureComponent {
43
43
} ) ;
44
44
}
45
45
}
46
- componentWillReceiveProps ( nextProps ) {
46
+ componentDidUpdate ( prevProps ) {
47
47
const { isHidden } = this . props ;
48
48
49
- if ( ! isHidden && nextProps . isHidden ) {
50
- this . hide ( nextProps ) ;
49
+ if ( ! prevProps . isHidden && isHidden ) {
50
+ this . hide ( this . props ) ;
51
51
}
52
- if ( isHidden && ! nextProps . isHidden ) {
53
- this . show ( nextProps ) ;
52
+ if ( prevProps . isHidden && ! isHidden ) {
53
+ this . show ( this . props ) ;
54
54
}
55
55
}
56
56
hide = props => {
Original file line number Diff line number Diff line change @@ -19,14 +19,13 @@ class Shake extends PureComponent {
19
19
animatedValue : new Animated . Value ( this . currentValue ) ,
20
20
} ;
21
21
}
22
- // componentDidMount
23
- componentWillReceiveProps ( nextProps ) {
22
+ componentDidUpdate ( prevProps ) {
24
23
const { value } = this . props ;
25
24
26
25
// Perform the shake if our `value` prop has been changed and is
27
26
// being changed to a truthy value.
28
- if ( value !== nextProps . value && ! ! nextProps . value ) {
29
- this . move ( nextProps ) ;
27
+ if ( prevProps . value !== value && ! ! value ) {
28
+ this . move ( this . props ) ;
30
29
}
31
30
}
32
31
move = props => {
Original file line number Diff line number Diff line change @@ -168,8 +168,8 @@ class SharedElement extends PureComponent {
168
168
componentDidMount ( ) {
169
169
setProps ( this . props ) ;
170
170
}
171
- componentWillReceiveProps ( nextProps ) {
172
- setProps ( nextProps ) ;
171
+ componentDidUpdate ( ) {
172
+ setProps ( this . props ) ;
173
173
}
174
174
componentWillUnmount ( ) {
175
175
const { startOnDestinationWillUnmount } = this . props ;
Original file line number Diff line number Diff line change @@ -35,11 +35,11 @@ class TranslateX extends PureComponent {
35
35
} ) ;
36
36
}
37
37
}
38
- componentWillReceiveProps ( nextProps ) {
38
+ componentDidUpdate ( prevProps ) {
39
39
const { value } = this . props ;
40
40
41
- if ( value !== nextProps . value ) {
42
- this . move ( nextProps . value ) ;
41
+ if ( prevProps . value !== value ) {
42
+ this . move ( this . props ) ;
43
43
}
44
44
}
45
45
move = toValue => {
Original file line number Diff line number Diff line change @@ -25,11 +25,11 @@ class TranslateXY extends PureComponent {
25
25
translateValue : new Animated . ValueXY ( { x, y } ) ,
26
26
} ;
27
27
}
28
- componentWillReceiveProps ( nextProps ) {
28
+ componentDidUpdate ( prevProps ) {
29
29
const { x, y } = this . props ;
30
30
31
- if ( x !== nextProps . x || y !== nextProps . y ) {
32
- this . move ( nextProps ) ;
31
+ if ( prevProps . x !== x || prevProps . y !== y ) {
32
+ this . move ( this . props ) ;
33
33
}
34
34
}
35
35
move = props => {
Original file line number Diff line number Diff line change @@ -37,11 +37,11 @@ class TranslateY extends PureComponent {
37
37
} ) ;
38
38
}
39
39
}
40
- componentWillReceiveProps ( nextProps ) {
40
+ componentDidUpdate ( prevProps ) {
41
41
const { value } = this . props ;
42
42
43
- if ( value !== nextProps . value ) {
44
- this . move ( nextProps . value ) ;
43
+ if ( prevProps . value !== value ) {
44
+ this . move ( this . props ) ;
45
45
}
46
46
}
47
47
move = toValue => {
Original file line number Diff line number Diff line change @@ -39,14 +39,14 @@ class TranslateYAndOpacity extends PureComponent {
39
39
} ) ;
40
40
}
41
41
}
42
- componentWillReceiveProps ( nextProps ) {
42
+ componentDidUpdate ( prevProps ) {
43
43
const { isHidden } = this . props ;
44
44
45
- if ( ! isHidden && nextProps . isHidden ) {
46
- this . hide ( nextProps ) ;
45
+ if ( ! prevProps . isHidden && isHidden ) {
46
+ this . hide ( this . props ) ;
47
47
}
48
- if ( isHidden && ! nextProps . isHidden ) {
49
- this . show ( nextProps ) ;
48
+ if ( prevProps . isHidden && ! isHidden ) {
49
+ this . show ( this . props ) ;
50
50
}
51
51
}
52
52
show ( props ) {
You can’t perform that action at this time.
0 commit comments