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.

null is not an object (evaluating 'this._listRef.scrollToIndex')

See original GitHub issue

Since switching from ListView to FlatList we’re getting some errors like this:

null is not an object (evaluating 'this._listRef.scrollToIndex')

They happen rarely, but I could confirm that this also happened on one of my devices (OnePlus 3 with Android 7). The app shutted down after I’ve tried to open a view with a FlatList in it. Sadly I wasn’t able to reproduce it.

This is the full output:

TypeError null is not an object (evaluating 'this._listRef.scrollToIndex') 
    index.android.bundle:207:2069 value
    index.android.bundle:817:11813 value
    index.android.bundle:817:3218 
    index.android.bundle:39:562 
    index.android.bundle:32:664 callTimer
    index.android.bundle:32:1084 callTimers
    index.android.bundle:30:3208 value
    index.android.bundle:30:959 
    index.android.bundle:30:2640 value
    index.android.bundle:30:931 value

Due to our logs it only happens on Android devices. We are on React Native 0.46 and react-navigation for our routes. Maybe the view is destroyed while RN tries to access this._listRef?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jasongrishkoffcommented, Sep 21, 2017

Also seeing this error pop up in my Android crash logs.

2reactions
dnishcommented, Sep 16, 2017

@charpeni Does this really need a repo when it appears in the error logs of Bugsnag? I’m just wondering, when I take a look into https://github.com/facebook/react-native/blob/d1372faeb5f9ebc87a8dc9b8c9f31590bda414ea/Libraries/Lists/FlatList.js#L395 there are a checks for this._listRef.

 if (this._listRef) {
      return this._listRef.getScrollableNode();
}

But this check is missing in https://github.com/facebook/react-native/blob/d1372faeb5f9ebc87a8dc9b8c9f31590bda414ea/Libraries/Lists/FlatList.js#L342

I guess there is a reason why we need to check for this._listRef in the other functions? So maybe someone forgot to check for it also in scrollToIndex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native null is not an object (evaluating '_scrollView ...
I think this line here setInterval(function() { should be an arrow function like this setInterval(() => { so you can use this inside....
Read more >
RN: Android app crash - null is not an object (evaluating 'u ...
Introduced in 1.20. Reported in Sentry. Stack trace. TypeError: null is not an object (evaluating 'u.flatListRef.current.scrollToOffset')
Read more >
React native returning typeerror:null is not an object ...
I dont know what is wrong with this react native app that am creating that is returning the above error and I can't...
Read more >
React Native FlatList scrollToIndex with Fixed or ... - YouTube
In this video, I show you how to use the scrollToIndex function to scroll to a row with a certain index in a...
Read more >
FlatList scrollToIndex practical example. - Expo Snack
FlatList scrollToIndex practical example. No description. Open with Expo Go. Open in editor. Need Expo? Don't have the Expo Go? Download the app...
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