Skip to content

Commit d4f4f3f

Browse files
committed
trying something else
1 parent a3a095d commit d4f4f3f

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

core/src/components/router-outlet/route-outlet.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
2020
private gesture?: Gesture;
2121
private ani?: Animation;
2222
private animationEnabled = true;
23-
private isTransitioning = false;
2423

2524
@Element() el!: HTMLElement;
2625

@@ -64,7 +63,7 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
6463
async connectedCallback() {
6564
this.gesture = (await import('../../utils/gesture/swipe-back')).createSwipeBackGesture(
6665
this.el,
67-
() => !this.isTransitioning && !!this.swipeHandler && this.swipeHandler.canStart() && this.animationEnabled,
66+
() => !!this.swipeHandler && this.swipeHandler.canStart() && this.animationEnabled,
6867
() => this.swipeHandler && this.swipeHandler.onStart(),
6968
step => this.ani && this.ani.progressStep(step),
7069
(shouldComplete, step, dur) => {
@@ -185,8 +184,6 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
185184
const animated = this.animated && config.getBoolean('animated', true);
186185
const animationBuilder = this.animation || opts.animationBuilder || config.get('navAnimation');
187186

188-
this.isTransitioning = true;
189-
190187
await transition({
191188
mode,
192189
animated,
@@ -201,8 +198,6 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
201198
animationBuilder,
202199
});
203200

204-
this.isTransitioning = false;
205-
206201
// emit nav changed event
207202
this.ionNavDidChange.emit();
208203

core/src/utils/transition/ios.transition.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,22 @@ export const iosTransitionAnimation = (navEl: HTMLElement, opts: TransitionOptio
233233
.duration(opts.duration || DURATION)
234234
.easing(opts.easing || EASING)
235235
.fill('both')
236-
.beforeRemoveClass('ion-page-invisible');
236+
.beforeRemoveClass('ion-page-invisible')
237+
.beforeAddWrite(() => {
238+
/**
239+
* When transitioning, the page should not
240+
* respond to click events. This resolves small
241+
* issues like users trying to swipe to
242+
* go back while the page is transitioning in and
243+
* when double tapping the ion-back-button.
244+
*/
245+
enteringEl.style.setProperty('pointer-events', 'none');
246+
leavingEl.style.setProperty('pointer-events', 'none');
247+
})
248+
.afterAddWrite(() => {
249+
enteringEl.style.removeProperty('pointer-events');
250+
leavingEl.style.removeProperty('pointer-events');
251+
});
237252

238253
if (leavingEl && navEl) {
239254
const navDecorAnimation = createAnimation();

core/src/utils/transition/md.transition.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,22 @@ export const mdTransitionAnimation = (_: HTMLElement, opts: TransitionOptions):
1717
rootTransition
1818
.addElement(ionPageElement)
1919
.fill('both')
20-
.beforeRemoveClass('ion-page-invisible');
20+
.beforeRemoveClass('ion-page-invisible')
21+
.beforeAddWrite(() => {
22+
/**
23+
* When transitioning, the page should not
24+
* respond to click events. This resolves small
25+
* issues like users trying to swipe to
26+
* go back while the page is transitioning in and
27+
* when double tapping the ion-back-button.
28+
*/
29+
enteringEl.style.setProperty('pointer-events', 'none');
30+
leavingEl.style.setProperty('pointer-events', 'none');
31+
})
32+
.afterAddWrite(() => {
33+
enteringEl.style.removeProperty('pointer-events');
34+
leavingEl.style.removeProperty('pointer-events');
35+
});
2136

2237
// animate the component itself
2338
if (backDirection) {

0 commit comments

Comments
 (0)