From 36eee465d747533fae2fa93babba57ad1fc9a36b Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Fri, 18 Jan 2019 18:07:57 +0100 Subject: [PATCH] fix(content): tap-click deadlock --- core/src/components/content/content.tsx | 23 ++++++++++++------- core/src/components/nav/test/basic/index.html | 15 ++++++++++++ core/src/utils/tap-click.ts | 9 -------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/core/src/components/content/content.tsx b/core/src/components/content/content.tsx index ccf445e9fe5..ca57b06e407 100644 --- a/core/src/components/content/content.tsx +++ b/core/src/components/content/content.tsx @@ -1,4 +1,4 @@ -import { Component, ComponentInterface, Element, Event, EventEmitter, Method, Prop, QueueApi } from '@stencil/core'; +import { Component, ComponentInterface, Element, Event, EventEmitter, Method, Prop, QueueApi, Listen } from '@stencil/core'; import { Color, Config, Mode, ScrollBaseDetail, ScrollDetail } from '../../interface'; import { isPlatform } from '../../utils/platform'; @@ -113,8 +113,14 @@ export class Content implements ComponentInterface { } componentDidUnload() { - if (this.watchDog) { - clearInterval(this.watchDog); + this.onScrollEnd(); + } + + @Listen('click', { capture: true }) + onClick(ev: Event) { + if (this.isScrolling) { + ev.preventDefault(); + ev.stopPropagation(); } } @@ -269,13 +275,14 @@ export class Content implements ComponentInterface { } private onScrollEnd() { - clearInterval(this.watchDog); this.watchDog = null; - this.isScrolling = false; - this.ionScrollEnd.emit({ - isScrolling: false - }); + if (this.isScrolling) { + this.isScrolling = false; + this.ionScrollEnd.emit({ + isScrolling: false + }); + } } hostData() { diff --git a/core/src/components/nav/test/basic/index.html b/core/src/components/nav/test/basic/index.html index abaf35d2dd0..e67f4f214b2 100644 --- a/core/src/components/nav/test/basic/index.html +++ b/core/src/components/nav/test/basic/index.html @@ -37,6 +37,12 @@ --ion-background-color-rgb: 0,0,0; --ion-text-color-rgb: 255,255,255; } + +[f] { + background: green; + width: 100px; + height: 100px; +}