Skip to content

Commit

Permalink
fix: update library to support 0.60+ (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Panfyorov authored and xotahal committed Nov 28, 2019
1 parent 65e1353 commit 40187f0
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 40 deletions.
6 changes: 3 additions & 3 deletions src/AnimatedNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class AnimatedNumber extends React.PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

if (value !== nextProps.value) {
this.move(nextProps);
if (prevProps.value !== value) {
this.move(this.props);
}
}
onValueChanged = e => {
Expand Down
6 changes: 3 additions & 3 deletions src/AnimatedText.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class AnimatedText extends React.PureComponent {
originLength: value.length,
};
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

if (value !== nextProps.value) {
this.change(nextProps);
if (prevProps.value !== value) {
this.change(this.props);
}
}
onValueChanged = e => {
Expand Down
6 changes: 3 additions & 3 deletions src/Opacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Opacity extends PureComponent {
opacityValue: new Animated.Value(value),
};
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

if (value !== nextProps.value) {
this.move(nextProps);
if (prevProps.value !== value) {
this.move(this.props);
}
}
move = props => {
Expand Down
12 changes: 6 additions & 6 deletions src/Scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ class Scale extends PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
const { value } = this.props;
componentDidUpdate(prevProps) {
const { value, runAfterInteractions } = this.props;

if (value !== nextProps.value) {
if (prevProps.value !== value) {
if (this.interaction) {
this.interaction.cancel();
}

if (nextProps.runAfterInteractions) {
if (runAfterInteractions) {
this.interaction = InteractionManager.runAfterInteractions(() => {
this.interaction = null;
this.move(nextProps);
this.move(this.props);
});
} else {
this.move(nextProps);
this.move(this.props);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/ScaleAndOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class ScaleAndOpacity extends PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { isHidden } = this.props;

if (!isHidden && nextProps.isHidden) {
this.hide(nextProps);
if (!prevProps.isHidden && isHidden) {
this.hide(this.props);
}
if (isHidden && !nextProps.isHidden) {
this.show(nextProps);
if (prevProps.isHidden && !isHidden) {
this.show(this.props);
}
}
hide = props => {
Expand Down
7 changes: 3 additions & 4 deletions src/Shake.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ class Shake extends PureComponent {
animatedValue: new Animated.Value(this.currentValue),
};
}
// componentDidMount
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

// Perform the shake if our `value` prop has been changed and is
// being changed to a truthy value.
if (value !== nextProps.value && !!nextProps.value) {
this.move(nextProps);
if (prevProps.value !== value && !!value) {
this.move(this.props);
}
}
move = props => {
Expand Down
4 changes: 2 additions & 2 deletions src/SharedElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class SharedElement extends PureComponent {
componentDidMount() {
setProps(this.props);
}
componentWillReceiveProps(nextProps) {
setProps(nextProps);
componentDidUpdate() {
setProps(this.props);
}
componentWillUnmount() {
const { startOnDestinationWillUnmount } = this.props;
Expand Down
6 changes: 3 additions & 3 deletions src/TranslateX.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class TranslateX extends PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

if (value !== nextProps.value) {
this.move(nextProps.value);
if (prevProps.value !== value) {
this.move(this.props);
}
}
move = toValue => {
Expand Down
6 changes: 3 additions & 3 deletions src/TranslateXY.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class TranslateXY extends PureComponent {
translateValue: new Animated.ValueXY({ x, y }),
};
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { x, y } = this.props;

if (x !== nextProps.x || y !== nextProps.y) {
this.move(nextProps);
if (prevProps.x !== x || prevProps.y !== y) {
this.move(this.props);
}
}
move = props => {
Expand Down
6 changes: 3 additions & 3 deletions src/TranslateY.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class TranslateY extends PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { value } = this.props;

if (value !== nextProps.value) {
this.move(nextProps.value);
if (prevProps.value !== value) {
this.move(this.props);
}
}
move = toValue => {
Expand Down
10 changes: 5 additions & 5 deletions src/TranslateYAndOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class TranslateYAndOpacity extends PureComponent {
});
}
}
componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const { isHidden } = this.props;

if (!isHidden && nextProps.isHidden) {
this.hide(nextProps);
if (!prevProps.isHidden && isHidden) {
this.hide(this.props);
}
if (isHidden && !nextProps.isHidden) {
this.show(nextProps);
if (prevProps.isHidden && !isHidden) {
this.show(this.props);
}
}
show(props) {
Expand Down

0 comments on commit 40187f0

Please sign in to comment.