fix(nav): prevent completing transition from being interrupted (#19113)

* do not enable swipe to begin before previous one has ended

* update defaults

* use canStart instead

* pause animations on finish

* remove old pause code
This commit is contained in:
Liam DeBeasi
2019-08-16 13:33:39 -04:00
committed by GitHub
parent 624e118b56
commit fd65765bdf
3 changed files with 22 additions and 6 deletions

View File

@ -604,7 +604,7 @@ export const createAnimation = () => {
}
};
const initializeCSSAnimation = () => {
const initializeCSSAnimation = (toggleAnimationName = true) => {
cleanUpStyleSheets();
elements.forEach(element => {
@ -628,7 +628,10 @@ export const createAnimation = () => {
setStyleProperty(element, 'animation-iteration-count', iterationsCount);
setStyleProperty(element, 'animation-play-state', 'paused');
setStyleProperty(element, 'animation-name', `${stylesheet.id}-alt`);
if (toggleAnimationName) {
setStyleProperty(element, 'animation-name', `${stylesheet.id}-alt`);
}
requestAnimationFrame(() => {
setStyleProperty(element, 'animation-name', stylesheet.id || null);
});
@ -660,14 +663,14 @@ export const createAnimation = () => {
};
const initializeAnimation = () => {
const initializeAnimation = (toggleAnimationName = true) => {
beforeAnimation();
if (_keyframes.length > 0) {
if (supportsWebAnimations) {
initializeWebAnimation();
} else {
initializeCSSAnimation();
initializeCSSAnimation(toggleAnimationName);
}
}
@ -968,7 +971,7 @@ export const createAnimation = () => {
*/
const play = () => {
if (!initialized) {
initializeAnimation();
initializeAnimation(false);
}
if (finished) {