ionic-4-components icon indicating copy to clipboard operation
ionic-4-components copied to clipboard

feat: detect and handle adding/removing fiv-gallery-image dynamically

Open ryaa opened this issue 5 years ago • 1 comments

Feature Request

Describe the Feature Request Support adding/removing fiv-gallery-image dynamically in the below use case

          <fiv-gallery #gallery>
            <ion-slides>
              <ion-slide *ngFor="let photoDraft of recipePhotoDrafts">
                <div>
                  <fiv-gallery-image [src]="photoDraft.thumbnailAsBase64"></fiv-gallery-image>
                </div>
              </ion-slide>
            </ion-slides>
          </fiv-gallery>

Right now, new photos/images added are displayed but clicking on them does not open a preview. My assumption is that this is because images QueryList is not subscribed for changes and the fiv-gallery does not take into account if image(s) are added/removed.

Describe Preferred Solution The dynamically added images must support click to open a preview.

Describe Alternatives

Subscribe to images QueryList changes and handle them accordingly. Right now I have to use showGallery flag and toggle it off and on to accomodate the changes but this makes the component to flicker when it is re-rendered.

          <fiv-gallery #gallery *ngIf="showGallery === true">
            <ion-slides>
              <ion-slide *ngFor="let photoDraft of recipePhotoDrafts">
                <div>
                  <fiv-gallery-image [src]="photoDraft.thumbnailAsBase64"></fiv-gallery-image>
                </div>
              </ion-slide>
            </ion-slides>
          </fiv-gallery>

Related Code See above

Additional Context N/A

ryaa avatar Jul 24 '20 08:07 ryaa

Another use case is that the app needs to support deleting an image displayed in the preview. It should remove the image from the preview and who the appropriate images when the preview is dismissed.

ryaa avatar Jul 24 '20 11:07 ryaa