Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marker event does not fire in map #40

Closed
rostgoat opened this issue Sep 30, 2019 · 0 comments
Closed

marker event does not fire in map #40

rostgoat opened this issue Sep 30, 2019 · 0 comments

Comments

@rostgoat
Copy link

rostgoat commented Sep 30, 2019

Cannot for the life of me get this event of to fire on the child Marker
anyone know why?

I have tried using onClick, using bind and onChildClick but nothing works

onSelectMarker = marker => e => {
    e.preventDefault();
    console.log("clicked");
  };
  render() {
    const data = this.props.searchedResponse;

    const Markers = data
      ? data.data.records.map(marker => {
          return (
            <Marker
              key={marker.recordid}
              lat={marker.fields.geom.coordinates[1]}
              lng={marker.fields.geom.coordinates[0]}
              onChildClick={() => this.onSelectMarker(marker)}
            />
          );
        })
      : null;
    return (
      <div className="map">
        <GoogleMapReact
          center={this.state.center}
          zoom={this.state.zoom}
          bootstrapURLKeys={{
            key: process.env.REACT_APP_GOOGLE_KEY
          }}
        >
          {Markers}
        </GoogleMapReact>
      </div>
    );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant