MOBILE-4081 swipe: Only enable swipe when items are loaded

main
Pau Ferrer Ocaña 2022-11-23 16:41:52 +01:00
parent 1dd1dbb543
commit 1f1e786ad5
1 changed files with 3 additions and 4 deletions

View File

@ -73,11 +73,8 @@ export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy {
this.onRelease(ev); this.onRelease(ev);
}, },
}); });
this.swipeGesture.enable();
// Show user tour.
const source = this.manager?.getSource(); const source = this.manager?.getSource();
if (!source) { if (!source) {
return; return;
} }
@ -85,11 +82,13 @@ export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy {
await source.waitForLoaded(); await source.waitForLoaded();
const items = source.getItems() ?? []; const items = source.getItems() ?? [];
if (!this.enabled || items.length < 2) { if (!this.enabled || items.length < 2) {
return; return;
} }
this.swipeGesture.enable();
// Show user tour.
await CoreUserTours.showIfPending({ await CoreUserTours.showIfPending({
id: 'swipe-navigation', id: 'swipe-navigation',
component: CoreSwipeNavigationTourComponent, component: CoreSwipeNavigationTourComponent,