null is not an object (evaluating 'this._listRef.scrollToIndex')
See original GitHub issueSince 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:
- Created 6 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
Also seeing this error pop up in my Android crash logs.
@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
.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 inscrollToIndex
.