Skip to content

Commit

Permalink
fix: swipe not possible with animation="none"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanna_37 committed Nov 6, 2022
1 parent d321d09 commit 47e7f69
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/swipe-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,11 @@ class swipeManager {
const tabs = this.#getTabsArray();

if (view != null) {
if (Config.animate) {

if (Config.animate == "none") {
tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true }));

} else {
const duration = 200;
view.style.transition = `transform ${duration}ms ease-in, opacity ${duration}ms ease-in`;

Expand Down Expand Up @@ -607,16 +611,17 @@ class swipeManager {
view.style.transition = "";
tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true }));
}, duration + 10);

} else {
const exhaustiveCheck: never = Config.animate;
throw new Error(`Unhandled case: ${exhaustiveCheck}`);
}

setTimeout(function () {
view.style.transition = `transform ${duration}ms ease-out, opacity ${duration}ms ease-out`;
view.style.opacity = "1";
view.style.transform = "";
}, duration + 50);

} else {
tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true }));
}
}
}
Expand Down

0 comments on commit 47e7f69

Please sign in to comment.