question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ionic 4 ion-item-sliding stops sliding after list is updated

See original GitHub issue

Bug Report

Ionic version:

[x] 4.x

Current behavior:

Same bug as reported earlier but that does not fix the core issue but rather uses a workaround.

Expected behavior:

  • After the list is refreshed/updated, the elements should still be slide-able.

Steps to reproduce:

  • Create an <ion-list> of <ion-item-sliding> elements
  • Open the slide menu of one of the elements
  • Have the app update the list in the background (reassign the list variable)
  • The list refreshes and the elements are not able to use the slide gesture.

Related code:

// HTML
  <ion-list>
    <ion-item-sliding *ngFor='let a of list'>
      <ion-item>
        <ion-text>{{a}}</ion-text>
      </ion-item>

      <ion-item-options side="end">
        <ion-item-option color="danger">
          <ion-icon name="trash"></ion-icon>
          Delete
        </ion-item-option>
      </ion-item-options>
    </ion-item-sliding>
  </ion-list>

// COMPONENT/PAGE
  public list: string[] = ['A', 'B', 'C'];
  
  // use a short delay to update list after opening up the slide item
  this.list = ['A', 'B', 'C', 'D'];

Other information:

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.1.3
   @angular/cli                  : 7.1.3
   @ionic/angular-toolkit        : 1.2.0

System:

   NodeJS : v10.12.0 (/usr/local/Cellar/node/10.12.0/bin/node)
   npm    : 6.4.1
   OS     : macOS Mojave

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
OJ7commented, Jan 9, 2019

Thanks, I can likely use that. However the thing is I don’t want to (and shouldn’t have to) close the sliding items whenever the list is updated.

I have a list that is frequently being updated and would like the item to stay in the “open slide out” state if the user performed the action, even if there is a modification to the list.

I’ve noticed the same thing happens regardless of whether there is an addition or removal to the list. If the list is assigned to an equivalent list, the same issue occurs.

1reaction
pimolcommented, Jan 23, 2019

I want add to that cfguimaraes noted: if I modify the item without add or remove element, slide does not disappear but slide doesn’t not go back in no sliding position despite list has been updated. To be more clear, AFTER the update the screen remain as the image

immagine

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ion-item-sliding no working in v4 after reload items
Hello, I have an ion-list that shows a list of ion-item-sliding with the option of “delete” in each one. When I delete one,...
Read more >
Why Did Ionic 4 Ion-Slides Suddenly Stop Displaying Properly?
On the first load, they seem to be fine, but on any load after that: The pager doesn't work or show up; The...
Read more >
How to use Swiper with Ionic (instead of ion-slides) - YouTube
In this video we will implement the Swiper component without ion - slides, since it will be deprecated with Framework v6! ...
Read more >
ion-item-sliding example
Swipeback Gesture Configuration in Ionic 4 August 23rd 2019 Ionic 4/5 Ionic has built-in support for navigating back using the swipe gesture. If...
Read more >
Ionic3组件文档 - ionic中文网
Next, add an <ion-item-options> component inside of the sliding item to contain the buttons. For more information, Check out the API docs. <ion-list> ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found