ListView component is crashing when scrollToIndex() is used with async data source
See original GitHub issueThe issue can be seen on the link bellow.
I make a sample with a list of dogs breeds which is loaded from a REST service (DogService
).
The ListView
is bound to an Observable from BehaviorSubject
(DogStore
).
After the data is loaded from the REST service it is passed to the store.
If after the data is passed to the data store the scrollToIndex()
method is called the app crashes.
In the example I made maybe there is no sense to passing data like that but in a bigger project where the data can come from a different data sources I think there is. I’m open to suggestion for alternative implementations.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Easy Crash to cause using scrollToIndex | Telerik Forums
scrollToIndex (x) it can frequently crash when the component is still being internally setup. (From my point of view and NS's point of...
Read more >Application crashing from async method - Stack Overflow
I am debugging the application using an android phone. A listview is then created using the created list. The ui code seems to...
Read more >@nativescript/types-ios | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >[Solved]-React Native PushNotification onNotification method ...
Source : stackoverflow.com ... Cannot access the scrollToIndex() method in React Native using the useRef hook · Downloading a binary file with POST...
Read more >Blog · React Native
No more ListView s or DataSource s, stale rows, ignored bugs, ... Lists are used in many contexts, so we packed the new...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tsonevn any update on this? I’m getting a similar issue (for iOS, haven’t tried android). I have two pages with listviews and everytime a new item comes in, I push it to the bottom of the list and scroll to the bottom using scrollToIndex(listLength - 1). It doesn’t crash consistently, appears to happen only after switching back and forth between pages a few times and inserting new items.
I’ve tried surrounding the function call with a try{}catch block, but I’m not getting any output, the app just crashes.
@tsonevn Any update on this? For android the scrollToBottom function doesn’t cause issues but for iOS it occasionally crashes. Alternatively is there a way to catch this error instead of having it crash the app? Because surrounding the call in try{}catch blocks does not do the trick