Skip to content

Commit

Permalink
fix(item-sliding): account for swipe to go back gesture when opening …
Browse files Browse the repository at this point in the history
…item-options (#20777)

fixes #20773
  • Loading branch information
liamdebeasi committed Mar 25, 2020
1 parent 2d5d251 commit f23ac44
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/components/item-sliding/item-sliding.tsx
Expand Up @@ -73,7 +73,7 @@ export class ItemSliding implements ComponentInterface {
gestureName: 'item-swipe',
gesturePriority: 100,
threshold: 5,
canStart: () => this.canStart(),
canStart: ev => this.canStart(ev),
onStart: () => this.onStart(),
onMove: ev => this.onMove(ev),
onEnd: ev => this.onEnd(ev),
Expand Down Expand Up @@ -225,7 +225,18 @@ export class ItemSliding implements ComponentInterface {
this.sides = sides;
}

private canStart(): boolean {
private canStart(gesture: GestureDetail): boolean {
/**
* If very close to start of the screen
* do not open left side so swipe to go
* back will still work.
*/
const rtl = document.dir === 'rtl';
const atEdge = (rtl) ? (window.innerWidth - gesture.startX) < 15 : gesture.startX < 15;
if (atEdge) {
return false;
}

const selected = openSlidingItem;
if (selected && selected !== this.el) {
this.closeOpened();
Expand Down

0 comments on commit f23ac44

Please sign in to comment.