React-google-maps: Marker showed twice

Created on 24 Jun 2020  路  5Comments  路  Source: tomchentw/react-google-maps

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

Most helpful comment

@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.

All 5 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EvHaus picture EvHaus  路  3Comments

manoj150283 picture manoj150283  路  3Comments

timkraut picture timkraut  路  3Comments

madbean picture madbean  路  3Comments

craigcartmell picture craigcartmell  路  4Comments