fix(item-sliding): make sure options are ready

This commit is contained in:
Manu Mtz.-Almeida
2018-09-13 20:49:17 +02:00
parent 9d3a2598be
commit 7f59f91cda
2 changed files with 7 additions and 11 deletions

View File

@ -37,10 +37,6 @@ ion-item-options {
user-select: none; user-select: none;
z-index: $z-index-item-options; z-index: $z-index-item-options;
&.hydrated {
visibility: hidden;
}
} }
.item-options-start { .item-options-start {

View File

@ -67,7 +67,7 @@ export class ItemSliding {
async componentDidLoad() { async componentDidLoad() {
this.item = this.el.querySelector('ion-item'); this.item = this.el.querySelector('ion-item');
this.updateOptions(); await this.updateOptions();
this.gesture = (await import('../../utils/gesture/gesture')).createGesture({ this.gesture = (await import('../../utils/gesture/gesture')).createGesture({
el: this.el, el: this.el,
@ -139,7 +139,7 @@ export class ItemSliding {
return false; return false;
} }
private updateOptions() { private async updateOptions() {
const options = this.el.querySelectorAll('ion-item-options'); const options = this.el.querySelectorAll('ion-item-options');
let sides = 0; let sides = 0;
@ -148,14 +148,14 @@ export class ItemSliding {
this.leftOptions = this.rightOptions = undefined; this.leftOptions = this.rightOptions = undefined;
for (let i = 0; i < options.length; i++) { for (let i = 0; i < options.length; i++) {
const option = options.item(i); const option = await options.item(i).componentOnReady();
if (option.side === 'end') { if (option.side === 'start') {
this.rightOptions = option;
sides |= ItemSide.End;
} else {
this.leftOptions = option; this.leftOptions = option;
sides |= ItemSide.Start; sides |= ItemSide.Start;
} else {
this.rightOptions = option;
sides |= ItemSide.End;
} }
} }
this.optsDirty = true; this.optsDirty = true;