undefined is not an object

Hello… I am trying to make an app that can be used to trace the location of the iss and for that i m calling an api for getting the latitude and longitude and later using them with map view and marker from react-native-maps and on running the same on the device it shows undefined is not an object(evaluating ‘this.maps.setNativeProps’)

The link of the snack…

Hi @astro_g.a.l

It’s easier to figure things like this out or for someone else to help you if you can make a minimal example that demonstrates the problem.

Also, when you post a question in the Expo SDK section it’s useful to the people reading your question to know which Expo SDK version you’re using and which platform (Android/iOS/Web) you’re having the problem on.

If I take the example Snack from here and add your <Marker> code (with hard coded lat/long and updated image asset path) then it works for me:

Umm, the version of expo is 41 and the error persists on android version of expo, the error on the web says
(Cannot read properties of undefined (reading ‘style’)
Evaluating react-native-maps.js
Evaluating screens/IssLocation.js
Evaluating App.js
Loading App.js
TypeError: Cannot read properties of undefined (reading ‘style’)
at Object.module.exports (react-native-maps.js:3:6649)
at r (react-native-maps.js:3:182)
at Object.module.exports (react-native-maps.js:3:55159)
at r (react-native-maps.js:3:182)
at module.exports (react-native-maps.js:3:1062)
at eval (react-native-maps.js:3:1072)
at Object.eval (react-native-maps.js:3:62923)
at eval (react-native-maps.js:8:4)
at eval (react-native-maps.js:9:3)
at eval ())
and the it is not specifically clear of the loc of the issue as the error pops up on screen (not in the problems tab)

Well, if I open the snack from my last message and change the SDK to 41 I can open it on my Android phone and it works fine.

oh… i ll check that again and see if that works cuz the above scrnsht was on android phone

The issue actually arises when we click on meteors or ISS location…

You’re going to have to show us the code for some the markers that have this problem, but I have added some event handling to my snack. I’ve also shown two different ways. e.g. onPress and onSelect just specify a function name which is defined elsewhere, whereas the onDeselect event handler is in-line.

The MapView docs show a slight variation on what I used for the onDeselect event handler.

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