Animations interruptible with gesture and comment for more info

This commit is contained in:
Brent Vatne 2018-12-08 18:09:18 -08:00
parent d789cd35f4
commit 52f9bcecd3
1 changed files with 14 additions and 4 deletions

View File

@ -446,10 +446,20 @@ class StackViewLayout extends React.Component {
this._handleReleaseHorizontal(nativeEvent); this._handleReleaseHorizontal(nativeEvent);
} }
} else if (nativeEvent.state === State.ACTIVE) { } else if (nativeEvent.state === State.ACTIVE) {
// HACK if current is in animation don't start gesture // Switch to using gesture position
if (!this.props.transitionProps.position._animation) { this.positionSwitch.setValue(0);
this.positionSwitch.setValue(0);
} // By enabling the gesture switch and ignoring the position here we
// end up with a quick jump to the initial value and then back to the
// gesture. While this isn't ideal, it's preferred over preventing new
// gestures during the animation (all gestures should be interruptible)
// and we will properly fix it (interruptible and from the correct position)
// when we integrate reanimated. If you prefer to prevent gestures during
// transitions, then fork this library, comment the positionSwitch value set above,
// and uncomment the following two lines.
// if (!this.props.transitionProps.position._animation) {
// this.positionSwitch.setValue(0);
// }
} }
}; };