Error when using a FlatList only when I publish

#1

This very simple code (https://github.com/llamaluvr/react-native-test-flatlist) works just fine locally, but fails with an Expo blue screen error when I run it after publishing.

Basically, it’s the “blank” exp init template with an empty FlatList added to App.js.

You can try it at: https://exp.host/@llamaluvr/test-flatlist

I get the following error on iOS and Android:

What’s really strange if that if you just paste that code into a new exp init project and publish, it will probably work. It only happens after I start building out my app, and then once it happens, it never stops happening to that slug, as long as anything I publish has a FlatList in it. And it only happens when I publish - when I run locally, everything is fine. This is on Expo 24, very latest version of exp.

I was making a project with two screens in a React Navigation StackNavigator. I break the FlatList out into a separate component with a little bit of network IO to populate it. Then I publish and I get the error. Then I remove all of the navigation code and the separate component and the networking and set the code to just what is in the Github repo above, I still get the error. Even if I clear the cache with the -c flag or rm -rf node_modules, I still get the error.

I repeated this sequence twice- just put the FlatList in App.js, it works. Then add my navigation, move code to a separate component, add networking, it stops working when I publish. Then I reverted back to the empty FlatList in App.js, rm -rf node_modules, clear cache, it still shows the error. Finally, if I take the FlatList out entirely, it stops showing the error.

Again, it only happens when I publish and run it in Expo from the link. It doesn’t happen if I run the code locally.

1 Like
#2

Ok it sounds like there is definitely a bug here but it’s hard to tell exactly what’s going on.

First off, can you be more specific about what you did to get the first error? It’d be useful to get the code for this step:

I break the FlatList out into a separate component with a little bit of network IO to populate it. Then I publish and I get the error.

For this section:

Then add my navigation, move code to a separate component, add networking, it stops working when I publish. Then I reverted back to the empty FlatList in App.js, rm -rf node_modules, clear cache, it still shows the error. Finally, if I take the FlatList out entirely, it stops showing the error.

Are you sure you were getting the updated code each time you loaded the published app? This sounds like you might have loaded a cached version of the app the seconds time, which would explain this behavior. If this was on Android we load the new version in the background (see https://docs.expo.io/versions/latest/guides/publishing.html#deploying-to-the-app-store-and-play-store).

Also what exactly is published at https://exp.host/@llamaluvr/test-flatlist? It sounds like it’s not https://github.com/llamaluvr/react-native-test-flatlist because you said that worked when you published it.

#3

Looks like you’re hitting this issue: https://github.com/facebook/react-native/issues/17348. There’s a temporary fix in that thread.

#4

That looks like it’s it! Thanks! I gotta remember to check with that dev
flag off.

1 Like
closed #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.