Strange behavior of the Map.onMarkerPress

Does anyone work block “Map.onMarkerPress”?

This block has an “event” variable, but I can’t get any data from it! Assigning this variable to a Label displays a [object Object], but nothing happens when using the “object to JSON” block.

i was able to figure some of it out by searching onMarkerPress…

3 Likes

Great job, IWS!

1 Like

the onCalloutPress event though, does nothing and is never fired … looks like it was a bug in react and has been fixed… can you guys upstream this PR into your codebase pretty please?

Hi @IWS thank you so much for your “onMarkerPress”-example, it works for me.

Now I’ve tested it with two markers, but I alway get the same coordinates, no matter which marker I press. Is it possible that “event” returns an array, and if so, how can I get the current marker?

Despite what that GitHub issue says the bug was not fixed. I filed another GitHub issue with the react-native-maps repo earlier this month:

1 Like

Michael,

Is this on Android or iOS?

-Mark

@Mark I tested it on iOS. With ThunkableX.

Michael,

Im not seeing the issue that you are describing can you share (privately if you like) the URL of your project or a copy/share link?

-Mark

1 Like

Hi @Mark, thanks for the fast reply.

It took me some time to find out what happened. In the end, I now have two Projects in ThunkX that look nearly the same and now work correctly.
Yesterday they behaved differently. The one project responded correctly (two different markers -> onMarkerPress gives two different locations), the other did not. I found out, that one project (named “GoogleMaps Test”) had only the variables that I defined inside, in the other project (named “MapTestPress”) all variables from another project show up! I used a wrong variable, which sounded similar, but gave the wrong coordinates.

My new question now is: how can that be? I started with “MapTestPress” from scratch by clicking on “Create New App”, but it shows all other variables from another project. Did I do something wrong? If not then this must be an other subject.

Those are the URLs:
“MapTestPress”: https://x.thunkable.com/projects/5ce45e4f21b99bfc51c8d384/1545cf94-6dac-4e4d-a8f2-1a2d73499780/designer
“GoogleMaps Test”: https://x.thunkable.com/projects/5ce4731af04b4f69ebe80186/ff7949d0-1579-4858-9a51-6610d44b2bdf/designer
Do I have to switch the project to public?

@Michael_Rogulla Wow, that’s a weird bug! Thanks for discovering it. We’re looking into it.

-Mark

1 Like

Michael,

We are testing a fix for this and it should be included in an upcoming release. Thanks again for discovering the bug!

-Mark