question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

programmatically click marker

See original GitHub issue
screen shot 2018-04-16 at 11 59 18 am I have a scrollable/horizontal list of locations on the bottom of the map, the idea is that the user can click on a location in this list, and I want to programmatically click or show the corresponding markers InfoWindow.

I have this method for when a user clicks on a marker which works fine:

onMarkerClick(props, marker, e) { this.setState({ selectedPlace: props, activeMarker: marker, showingInfoWindow: true }); }

While i can reproduce the “props” parameter, I haven’t been able to reproduce the “marker” parameter.

Is there anyway to do what I describe?

In the attached file I want to be able to click on the banner on the bottom, Strathcona Park, when I do that, I want to open up the markers InfoWindow inside the map.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:12

github_iconTop GitHub Comments

5reactions
abedshcommented, Jan 16, 2019

You can reference the marker you want to click by ref id.

<Marker ref={“marker1”} />

retrieve the marker you want to with var ref= this.refs.marker1;

4reactions
FelixSchwarzmeiercommented, Jan 31, 2019

Thanks @abedsh 👍 You can then call onMarkerClick using:

this.onMarkerClick(this.refs.marker1.props, this.refs.marker1.marker);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Programmatically click on marker and map - Stack Overflow
The right way to trigger a marker click/event programmatically is by using google.maps.event : google.maps.event.trigger(marker, 'click').
Read more >
Google Maps Marker click event programmatically?
Good morning, I use Google Maps Native and I created a marker's click event : marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => { .
Read more >
Markers | Maps JavaScript API - Google Developers
Markers are designed to be interactive. For example, by default they receive 'click' events, so you can add an event listener to bring...
Read more >
Maps API v3 Trigger a marker click from an external link
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Read more >
Xamarin.Forms.Maps - Pin.SendMarkerClick Method
Xamarin.Forms.Maps - How to fire pin click event programmatically - Pin.SendMarkerClick Method. I have a list of map locations when I click ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found