[Solved] How do the event blocks for the Map component work?

What is the Event block (onPress, onLongPress, onCalloutPress) for and how is it used?

1 Like

bump!

Those blocks are triggered, respectively, when a user clicks on a map, long presses on a map (i.e. clicks and holds their finger down) or clicks on the the “bubble” that appears when they click on a marker.

Unfortunately, there are a few known issues with the Map event blocks. One is that the onCalloutPress doesn’t appear to work at all. Another is that the output blocks for the events (e.g., "coordinate", "position" and "event") are either incorrectly named, unhelpfully named or simply unusable.

I’ve created a sample project that you can use that shows how, despite the issues mentioned above, to get latitude and longitude for the onPress, onLongPress, onMarkerPress blocks: Thunkable

If you just want to see the blocks, here’s a screenshot:

I hope this helps.

-Mark

5 Likes

thanks for the reply… i actually ended up figuring most of it out by searching react github and it seems there is a fix for the calloutonpress event that was just pushed last month… any chance of incorporating that any time soon?

15 posts were split to a new topic: Get Lat and Lng from map press

It gives me the latitude and the longitude but only singularly, when I try to write them both in 2 different labels it only gives back one response, lat or long.

I can’t open your link because it’s private.

What’s the ‘position’ response we can get from the press on the map event?

Hi @Mark, thanks for your help! The link to your project isn’t working for me. Is there any way you could send a different copy link?

Hi,

Some weeks ago the map component started to send null values. It is a bug. The developers started to work on it. Look at this link for more details:

Br,

Hi,
I could not extract description from event of OnMarkerPress.


Only latitude and longitude could be extracted.
It appears to be empty.
Is it a bug?

I believe that “On Marker Press” only returns the latitude and longitude, nothing more.

Thanks for the reply… Yes, that was all I managed to extract too.