tomchentw / react-google-maps

React.js Google Maps integration component

Home Page:https://tomchentw.github.io/react-google-maps/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Marker showed twice

cinder92 opened this issue · comments

After following the documentation im getting a weird behavior, which the map is rendering two markers, and the map has only one marker

import React from 'react';
import {
  withScriptjs,
  withGoogleMap,
  GoogleMap,
  Marker,
} from 'react-google-maps';
import { config } from '../settings';

const GoogleMaps = withScriptjs(
  withGoogleMap(props => (
    <GoogleMap defaultZoom={8} defaultCenter={{ lat: -34.397, lng: 150.644 }}>
      {props.isMarkerShown && (
        <Marker draggable position={{ lat: -34.397, lng: 150.644 }} />
      )}
    </GoogleMap>
  ))
);

const Map = () => {
  return (
    <GoogleMaps
      googleMapURL={`https://maps.googleapis.com/maps/api/js?key=${config.GOOGLE_MAPS_API_KEY}&v=3.exp&libraries=geometry,drawing,places`}
      loadingElement={<div style={{ height: `100%` }} />}
      containerElement={<div style={{ height: `300px` }} />}
      mapElement={<div style={{ height: `100%` }} />}
      isMarkerShown
    />
  );
};

export default Map;

Captura de Pantalla 2020-06-24 a la(s) 11 50 33

Note,that i dragged the marker just to show the issue

@JustFly1984 Please mention it on the repository's main page. It may help other users.

@shivamjjha I have no contact with developer of this package, nor I have ability to change code. That is downside of open source software. That is why I had to fork this lib 2 years ago.

hey @JustFly1984 can you look at my code and see what's wrong. The marker is shown twice. I don't want to write the whole code again by some other library. If you could please have a look at it. Thanks.

Sandbox Link

@shivamjjha I do not support this library. It is not maintained more than 3 years. Please consider to switch to my new version.