in extensions/virtuallistview/src/VirtualListCell.tsx [257:321]
setTop(top: number, animate = false, animationDelay = 0, animationOvershoot = 0) {
if (top !== this._top) {
this._top = top;
if (this._isVisible) {
let isReplacingPendingAnimation = false;
// Stop any pending animation.
if (this._topAnimation) {
const animationToCancel = this._topAnimation;
// The call to stop() will invoke the stop callback. If we are
// going to replace a pending animation, we'll make it look like
// a continuous animation rather than calling the callback multiple
// times. If we're not replacing the animation with another animation,
// allow the onAnimateStartStop to proceed.
if (animate) {
this._topAnimation = undefined;
}
animationToCancel.stop();
isReplacingPendingAnimation = true;
}
if (animate) {
if (animationOvershoot !== 0) {
this._topAnimation = RX.Animated.sequence([
RX.Animated.timing(this._topValue, {
toValue: top + animationOvershoot,
duration: 200,
delay: animationDelay,
easing: _skypeEaseInAnimationCurve,
}),
RX.Animated.timing(this._topValue, {
toValue: top,
duration: 400,
easing: _skypeEaseOutAnimationCurve,
}),
]);
} else {
this._topAnimation = RX.Animated.timing(this._topValue, {
toValue: top,
duration: 200,
delay: animationDelay,
easing: RX.Animated.Easing.InOut(),
});
}
if (!isReplacingPendingAnimation && this.props.onAnimateStartStop && this._itemKey) {
this.props.onAnimateStartStop(this._itemKey, true);
}
this._topAnimation.start(() => {
// Has the animation been canceled?
if (this._topAnimation) {
this._topAnimation = undefined;
if (this.props.onAnimateStartStop && this._itemKey) {
this.props.onAnimateStartStop(this._itemKey, false);
}
}
});
} else {
this._topValue.setValue(top);
}
}
}
}