summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-10 09:43:32 -0200
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-11 12:38:23 -0200
commitc58446d080645bc1d8b5368b5aca9dc211ca17c0 (patch)
tree3c9b1f3b94838ef01a1c9a6866dc99f8fae5ab70
parent22bb2777d95b79242f92c3ea06b72f087849e7d8 (diff)
downloadmullvadvpn-c58446d080645bc1d8b5368b5aca9dc211ca17c0.tar.xz
mullvadvpn-c58446d080645bc1d8b5368b5aca9dc211ca17c0.zip
Fix notification banner animation race condition
An animation is sometimes created that animates to the target height before the proper height is calculated, so it animates to zero. Afterwards, the proper height is calcuated and set, but the animation would reset it to zero when it finishes.
-rw-r--r--gui/packages/desktop/src/renderer/components/NotificationBanner.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/gui/packages/desktop/src/renderer/components/NotificationBanner.js b/gui/packages/desktop/src/renderer/components/NotificationBanner.js
index 1e27712de7..7a784058c1 100644
--- a/gui/packages/desktop/src/renderer/components/NotificationBanner.js
+++ b/gui/packages/desktop/src/renderer/components/NotificationBanner.js
@@ -226,6 +226,7 @@ export class NotificationBanner extends Component<
} else {
this._didFinishFirstLayoutPass = true;
if (this.props.visible) {
+ this._stopAnimation();
this._heightValue.setValue(height);
}
}
@@ -237,10 +238,7 @@ export class NotificationBanner extends Component<
return;
}
- if (this._animation) {
- this._animation.stop();
- this._animation = null;
- }
+ this._stopAnimation();
// calculate the animation duration based on travel distance
const layout = await UserInterface.measureLayoutRelativeToWindow(containerView);
@@ -264,4 +262,11 @@ export class NotificationBanner extends Component<
}
});
}
+
+ _stopAnimation() {
+ if (this._animation) {
+ this._animation.stop();
+ this._animation = null;
+ }
+ }
}