-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ios crash on back navigation when using visibility-binding inside itemtemplate #58
Comments
I just noticed that the isue can be prevented by resetting the whole by re-setting the whole ObservableAeeay instead of clearing and pushing items to it. Instead
do
But actually I thought it would be a better practice to re-use the existing ObservableARray instead of creating a new one every time I load the list items from our server. |
@felixkrautschuk not sure it is directly related to this plugin. The error happens on N side. |
@farfromrefug I am also not sure why this plugin should cause the issue. I just noticed that the crash did not appear when doing the same stuff with ListView or RadListView. |
@felixkrautschuk I missed that part ! Will try to look at it when I can |
@felixkrautschuk by the way doing the slice then push is not optimized as you do 2 operations whuh means 2 collectionview updates. Instead do a splice removing all and adding all new ones. |
@farfromrefug I tried to remove the items and add new items in one step with using the splice method, but then I see those layout issues again as described in #57 and the crash is also still happening. Both things only happen in our own app, I was not able yet to make them reproducable in the sample app so far. However I noticed, that there also seems to be a timing issue.
... then the app is crashing. |
Finally, I managed to find out why the layout issue and the crash still orccur in our own app with splicing and pushing items in one step. It's because item count can change as well while navigating forwards and backwards. When I change the demo app, that it always pushes a random number of items to the list like this:
... then the layout issue and the crash are reproducable in the demo app as well: Bildschirmaufnahme.2023-04-14.um.16.15.41.movUpdated demo app: |
@felixkrautschuk and it does not happen with listview and rlv? |
@farfromrefug with ListView, everything works as expected (no layout issues, no crashes)
|
Btw, the crash for RadListView can be prevented bei calling listview.refresh() in the loaded-event of RadListView. |
@felixkrautschuk sorry dont have much time to look at they right now |
@felixkrautschuk I've got the exact same error (only on iOS aswell, Android works fine). I think it could be related to bugs in |
@MrSnoozles I only found out that I could prevent the crash and the layout issue by creating a new ObservableArray everytime I want to remove/add items, but actually that should not be necessary. |
@felixkrautschuk i tested taht a bit.
So for now it is a wont fix here as the example shows clear issues. |
@farfromrefug thanks for your investigations and sorry for late reply. Regarding the time of loading the items: I actually load everything in navigatingTo event in our apps, as it feels smooth. Sometimes the loading process is really fast, so it feels like the data is already there when the page is shown to the user. When doing that in navigatedTo event, it feels really weird as the user gets a blank page or only a placeholder for half a second and then only the loading process begins. And yes, I have used that "shared" ObservableArray approach for years now with RadListView and ListView as I never had problems with that. But I got your point and I admit, that it is not a good practice. Just want to add one thing: there is one weird effect with iOS 16.4 (I updated Xcode 14.3 last week).
At first I thought that it is a timing issue and I am forced to use navigatedTo event, but then I noticed that I can prevent the crash by using a setTimeout even with 0 delay:
Do you an explanation for that? When using RadListView (or ListView), this issue is not occuring. Latest sample app: |
@farfromrefug - This seems to be an iOS 16.4 bug: https://developer.apple.com/forums/thread/728797 It looks like a possible solution to get around this case would be to switch from UICollectionViewDataSource to UICollectionViewDiffableDataSource as the data source being used within the plugin codebase. |
Make sure to check the demo app(s) for sample usage
Make sure to check the existing issues in this repository
If the demo apps cannot help and there is no issue for your problem, tell us about it
Please, ensure your title is less than 63 characters long and starts with a capital
letter.
When navigating forwards and then backwards between multiple instances of a page using a collectionview, the iOS app crashes, when using a visibility binding inside the itemTemplate.
I only occurs when navigating at least 2 times to the same page.
Hard to explain by words, look at the video:
Bildschirmaufnahme.2023-03-30.um.14.14.42.mov
Not sure if this is really related to collectionview or maybe nativescript/core, but the issue only occurs using collectionview for us so far (not with RLV or default ListView), so I decided to report it here.
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
Just follow the steps from the video provided above
Is there any code involved?
ns-collectionview.zip
The text was updated successfully, but these errors were encountered: