Skip to content

Commit 40187f0

Browse files
Oleg Panfyorovxotahal
Oleg Panfyorov
authored andcommitted
fix: update library to support 0.60+ (#35)
1 parent 65e1353 commit 40187f0

11 files changed

+39
-40
lines changed

src/AnimatedNumber.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class AnimatedNumber extends React.PureComponent {
3939
});
4040
}
4141
}
42-
componentWillReceiveProps(nextProps) {
42+
componentDidUpdate(prevProps) {
4343
const { value } = this.props;
4444

45-
if (value !== nextProps.value) {
46-
this.move(nextProps);
45+
if (prevProps.value !== value) {
46+
this.move(this.props);
4747
}
4848
}
4949
onValueChanged = e => {

src/AnimatedText.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ class AnimatedText extends React.PureComponent {
2828
originLength: value.length,
2929
};
3030
}
31-
componentWillReceiveProps(nextProps) {
31+
componentDidUpdate(prevProps) {
3232
const { value } = this.props;
3333

34-
if (value !== nextProps.value) {
35-
this.change(nextProps);
34+
if (prevProps.value !== value) {
35+
this.change(this.props);
3636
}
3737
}
3838
onValueChanged = e => {

src/Opacity.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class Opacity extends PureComponent {
1919
opacityValue: new Animated.Value(value),
2020
};
2121
}
22-
componentWillReceiveProps(nextProps) {
22+
componentDidUpdate(prevProps) {
2323
const { value } = this.props;
2424

25-
if (value !== nextProps.value) {
26-
this.move(nextProps);
25+
if (prevProps.value !== value) {
26+
this.move(this.props);
2727
}
2828
}
2929
move = props => {

src/Scale.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ class Scale extends PureComponent {
3434
});
3535
}
3636
}
37-
componentWillReceiveProps(nextProps) {
38-
const { value } = this.props;
37+
componentDidUpdate(prevProps) {
38+
const { value, runAfterInteractions } = this.props;
3939

40-
if (value !== nextProps.value) {
40+
if (prevProps.value !== value) {
4141
if (this.interaction) {
4242
this.interaction.cancel();
4343
}
4444

45-
if (nextProps.runAfterInteractions) {
45+
if (runAfterInteractions) {
4646
this.interaction = InteractionManager.runAfterInteractions(() => {
4747
this.interaction = null;
48-
this.move(nextProps);
48+
this.move(this.props);
4949
});
5050
} else {
51-
this.move(nextProps);
51+
this.move(this.props);
5252
}
5353
}
5454
}

src/ScaleAndOpacity.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ class ScaleAndOpacity extends PureComponent {
4343
});
4444
}
4545
}
46-
componentWillReceiveProps(nextProps) {
46+
componentDidUpdate(prevProps) {
4747
const { isHidden } = this.props;
4848

49-
if (!isHidden && nextProps.isHidden) {
50-
this.hide(nextProps);
49+
if (!prevProps.isHidden && isHidden) {
50+
this.hide(this.props);
5151
}
52-
if (isHidden && !nextProps.isHidden) {
53-
this.show(nextProps);
52+
if (prevProps.isHidden && !isHidden) {
53+
this.show(this.props);
5454
}
5555
}
5656
hide = props => {

src/Shake.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ class Shake extends PureComponent {
1919
animatedValue: new Animated.Value(this.currentValue),
2020
};
2121
}
22-
// componentDidMount
23-
componentWillReceiveProps(nextProps) {
22+
componentDidUpdate(prevProps) {
2423
const { value } = this.props;
2524

2625
// Perform the shake if our `value` prop has been changed and is
2726
// 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);
3029
}
3130
}
3231
move = props => {

src/SharedElement.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ class SharedElement extends PureComponent {
168168
componentDidMount() {
169169
setProps(this.props);
170170
}
171-
componentWillReceiveProps(nextProps) {
172-
setProps(nextProps);
171+
componentDidUpdate() {
172+
setProps(this.props);
173173
}
174174
componentWillUnmount() {
175175
const { startOnDestinationWillUnmount } = this.props;

src/TranslateX.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class TranslateX extends PureComponent {
3535
});
3636
}
3737
}
38-
componentWillReceiveProps(nextProps) {
38+
componentDidUpdate(prevProps) {
3939
const { value } = this.props;
4040

41-
if (value !== nextProps.value) {
42-
this.move(nextProps.value);
41+
if (prevProps.value !== value) {
42+
this.move(this.props);
4343
}
4444
}
4545
move = toValue => {

src/TranslateXY.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class TranslateXY extends PureComponent {
2525
translateValue: new Animated.ValueXY({ x, y }),
2626
};
2727
}
28-
componentWillReceiveProps(nextProps) {
28+
componentDidUpdate(prevProps) {
2929
const { x, y } = this.props;
3030

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);
3333
}
3434
}
3535
move = props => {

src/TranslateY.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class TranslateY extends PureComponent {
3737
});
3838
}
3939
}
40-
componentWillReceiveProps(nextProps) {
40+
componentDidUpdate(prevProps) {
4141
const { value } = this.props;
4242

43-
if (value !== nextProps.value) {
44-
this.move(nextProps.value);
43+
if (prevProps.value !== value) {
44+
this.move(this.props);
4545
}
4646
}
4747
move = toValue => {

src/TranslateYAndOpacity.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class TranslateYAndOpacity extends PureComponent {
3939
});
4040
}
4141
}
42-
componentWillReceiveProps(nextProps) {
42+
componentDidUpdate(prevProps) {
4343
const { isHidden } = this.props;
4444

45-
if (!isHidden && nextProps.isHidden) {
46-
this.hide(nextProps);
45+
if (!prevProps.isHidden && isHidden) {
46+
this.hide(this.props);
4747
}
48-
if (isHidden && !nextProps.isHidden) {
49-
this.show(nextProps);
48+
if (prevProps.isHidden && !isHidden) {
49+
this.show(this.props);
5050
}
5151
}
5252
show(props) {

0 commit comments

Comments
 (0)