We are encountering a rather strange phenomena with .map
in our React-Native (version 0.59.3) project: The APK runs well on various physical devices or emulators, but not on Android Version 9.0 where it crashes with
TypeError: o.map is not a function.
(In 'o.map(function(t,n){n.icon_color=A.white,
-1!==s.findIndex(function(n){return t.title==n.title})
&&(t.icon_color=A.red)})','o.map' is undefined)
This is how the error popup looks like:
We understand that this message appears if the variable on which we are applying .map
is not an array, but we do indeed make sure that it is (and anyhow it works on various other versions and devices). What are we missing here?
Some background for the curious
We have two arrays, one is an array of data sets we obtain from an API response, and the other one is a list of bookmarked data sets from a local DB on the device. We apply the map functionality on the API response array and check if a certain item from the data set is present in the database of favorites. Based on this, we change the color of the icon. According to our tester, he did also have internet access, but we anyhow monitor @react-native-community/netinfo
version 2.0.0.
Related questions