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.

ListView component is crashing when scrollToIndex() is used with async data source

See original GitHub issue

The 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.

https://play.nativescript.org/?template=play-ng&id=ehB2Sd

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
fhackenbcommented, Feb 21, 2018

@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.

1reaction
fhackenbcommented, Mar 12, 2018

@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

Read more comments on GitHub >

github_iconTop 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 >

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