triniwiz / nativescript-pager

Apache License 2.0
90 stars 48 forks source link

Changing a property on nested object causes ordering problems #177

Open kryptus36 opened 4 years ago

kryptus36 commented 4 years ago

Which platform(s) does your issue occur on?

Only tested on android

Please, provide the following version numbers that your issue occurs with:

6.7.4

6.5.1

Android 6.5.0

Please, tell us how to recreate the issue in as much detail as possible.

I've created a simple bingo card as an example. There is an array of 5 bingo cards in the pager, each has some spaces daubed and some not.

Here's the really odd part: tapping a space triggers the toggleDaub method, and it seems to work fine on cards index 0 & 1. But try it on cards 2,3,4 and the cards at the end get moved to the beginning -- even though the ordering of the array itself has not changed.

May be related to https://stackoverflow.com/questions/58451314/adding-items-dynamically-in-nativescript-pager-screws-up-view-order

Is there any code involved?

https://github.com/kryptus36/ns-pager-ordering

triniwiz commented 4 years ago

Hi have you tried binding to a observablearray ?

kryptus36 commented 4 years ago

I just tried now (code is pushed to above repo). Unfortunately the results are the same.

triniwiz commented 4 years ago

Thanks .. can you run it on iOS if not that’s ok

kryptus36 commented 4 years ago

Ah - that's interesting. Works as expected on iOS.

kryptus36 commented 4 years ago

Just as a note, it breaks similarly on iOS if you don't use the ObservableArray.

Thanks for your quick replies!

triniwiz commented 4 years ago

@kryptus36 I gave the ObservableArray more love since it has changeEvents which made things a bit easier and more performant i'll throw something together soon