Skip to content

Commit

Permalink
fix: fix run animation after interactions
Browse files Browse the repository at this point in the history
The animation was run even when the value was changed while waiting
for interactions.
  • Loading branch information
xotahal committed Mar 30, 2019
1 parent 3c9f34d commit 14e28f5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Scale extends PureComponent {

const { value, initValue } = props;

this.interaction = null;

this.state = {
scaleValue: new Animated.Value(initValue || value),
};
Expand All @@ -36,8 +38,13 @@ class Scale extends PureComponent {
const { value } = this.props;

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

if (nextProps.runAfterInteractions) {
InteractionManager.runAfterInteractions().then(() => {
this.interaction = InteractionManager.runAfterInteractions(() => {
this.interaction = null;
this.move(nextProps);
});
} else {
Expand Down

0 comments on commit 14e28f5

Please sign in to comment.