You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with dynamic list of cards (eg. fetching more cards from a datasource), adding cards while swiping in the forward direction works as expected. However, if loop is enabled, adding more cards while reverse swiping will cause the index to jump to the last index.
if you swipe in the forward direction card0 > card1 > card2
a new card3 is added
the view shows card2
when you swipe to card3
a new card4 is added
the view shows card3
...and so on.
However:
if you swipe card0 > card2 (in the reverse)
a new card3 will be added
the view shows card3
The expectation is that the view should show card2, because the swipe action takes the user to card2 first, then it adds card3 at the end of the list.
Once this bug is triggered, the forward direction swipe will also bug out. Meaning:
if you reverse swipe card0 > card2 to trigger the bug
the view will be on card3
now swipe in the forward direction card3 > card0 > card1 > card2 > card3
a new card4 will be added
the view will also show card4 immediately
meaning that card3 was skipped entirely
Imagine you're fetching 10 items at a time, that means that if this bug is triggered, 10 items will be skipped, and swiping back will see 10 new items before the user reaches the item they were on previously.
I've forked the repo to try and figure out the problem with an example, but I can't figure this out. Looking for someone with more experience with the package to help fix this bug. In the fork, you can run the example app and choose the last "Dynamic list" to option see the bug in action:
I just disable loop... it didn't make sense to have a loop while fetching new data anyway... I would only use loop if the of items are known in advance.
When working with dynamic list of cards (eg. fetching more cards from a datasource), adding cards while swiping in the forward direction works as expected. However, if loop is enabled, adding more cards while reverse swiping will cause the index to jump to the last index.
Suppose we have the following:
In the above code:
However:
The expectation is that the view should show card2, because the swipe action takes the user to card2 first, then it adds card3 at the end of the list.
Once this bug is triggered, the forward direction swipe will also bug out. Meaning:
Imagine you're fetching 10 items at a time, that means that if this bug is triggered, 10 items will be skipped, and swiping back will see 10 new items before the user reaches the item they were on previously.
I've forked the repo to try and figure out the problem with an example, but I can't figure this out. Looking for someone with more experience with the package to help fix this bug. In the fork, you can run the example app and choose the last "Dynamic list" to option see the bug in action:
https://github.com/lhengl/card_swiper
The text was updated successfully, but these errors were encountered: