# Strange behavior of the Map.onMarkerPress

**URL:** <https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020>\
**Category:** Questions about Thunkable X\
**Created:** [October 21, 2018, 3:18pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020 "2018-10-21T15:18:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [October 21, 2018, 3:18pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/1 "2018-10-21T15:18:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![IWS](https://avatars.discourse-cdn.com/v4/letter/i/50afbb/32.png) [@IWS](https://community.thunkable.com/u/IWS)\
**Post date:** [May 1, 2019, 4:02pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/2 "2019-05-01T16:02:44Z")

</div>

> <https://github.com/react-native-community/react-native-maps/issues/260>

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

[![](https://i.imgur.com/7QX8Zip.png) ](https://i.imgur.com/7QX8Zip.png)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 2, 2019, 7:31am UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/3 "2019-05-02T07:31:08Z")

</div>

Great job, IWS!

---

<div class="post-metadata">

**Author:** ![IWS](https://avatars.discourse-cdn.com/v4/letter/i/50afbb/32.png) [@IWS](https://community.thunkable.com/u/IWS)\
**Post date:** [May 2, 2019, 12:31pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/4 "2019-05-02T12:31:04Z")

</div>

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?

> <https://github.com/react-native-community/react-native-maps/issues/521>

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [May 21, 2019, 10:21pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/5 "2019-05-21T22:21:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [May 21, 2019, 10:38pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/6 "2019-05-21T22:38:15Z")

</div>

> [@IWS](#):
>
> looks like it was a bug in react and has been fixed… can you guys upstream this PR into your codebase pretty please?

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:

> <https://github.com/react-native-maps/react-native-maps/issues/2841>
>
> \### Is this a bug report?
> 
> Yes
> 
> 
> 
> \### Have you read the \[Installation Inst…ructions\](https://github.com/react-community/react-native-maps/blob/master/docs/installation.md)?
> 
> Yes
> 
> \### Environment
> 
> Please specify the react, react-native, react-native-maps versions, eg:
> 
> react-native: 0.57.1
> react: 16.5.0
> react-native-maps: 0.22.1
> 
> 
> Target Platform: eg: iOS - 12.1 Simulator/iPhone X
> 
> \*\*\*If your target is iOS , please specify if you are using AppleMaps or GoogleMaps
> 
> GoogleMaps
> 
> \### Steps to Reproduce
> 
> 
> 
> (Write your steps here:)
> 
> 1. Create app with a Google map, a Marker and an onCalloutPress event handler
> 2. Click on the Marker
> 3. Click on the Callout
> 
> \### Expected Behavior
> 
> 
> 
> (Write what you thought would happen.)
> 
> That the onCalloutPress event handler would be triggered
> 
> \### Actual Behavior
> 
> 
> 
> (Write what happened. Add screenshots!)
> 
> The onCalloutPress event handler as not triggered
> 
> \### Reproducible Demo
> 
> 
> 
> (Paste the link to an example project and exact instructions to reproduce the issue.)
> 
> https://snack.expo.io/@thunkmark/oncalloutpress-test
> 
> Make sure you are previewing on iOS.
> Click on the marker and then the callout and notice that nothing is logged to the console when you click the callout.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [May 21, 2019, 10:44pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/7 "2019-05-21T22:44:16Z")

</div>

> [@Michael\_Rogulla](#):
>
> 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?

Michael,

Is this on Android or iOS?

-Mark

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [May 21, 2019, 10:45pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/8 "2019-05-21T22:45:41Z")

</div>

@Mark I tested it on iOS. With ThunkableX.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [May 21, 2019, 10:59pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/9 "2019-05-21T22:59:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [May 22, 2019, 11:20am UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/10 "2019-05-22T11:20:22Z")

</div>

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](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](https://x.thunkable.com/projects/5ce4731af04b4f69ebe80186/ff7949d0-1579-4858-9a51-6610d44b2bdf/designer)  
Do I have to switch the project to public?

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [May 22, 2019, 8:12pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/11 "2019-05-22T20:12:45Z")

</div>

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

-Mark

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [June 24, 2019, 4:19pm UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/12 "2019-06-24T16:19:13Z")

</div>

Michael,

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

-Mark

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:55am UTC](https://community.thunkable.com/t/strange-behavior-of-the-map-onmarkerpress/53020/13 "2024-11-08T11:55:04Z")

</div>


