Skip to content

Markers flicker when scrolling on the map #1117

@CrissAlvarezH

Description

@CrissAlvarezH

When the map is scrolled and the mouse is released, the markers blink from where they were initially positioned.

The code

import React from "react";
import GoogleMapReact from 'google-map-react';


const AnyReactComponent = ({ text }) => (
    <div style={{
        width: "70px",
        backgroundColor: "black",
        color: "white",
        padding: 2,
        textAlign: "center"
    }}>
        {text}
    </div>
);

const center =     {
    lat: 8.789109769101659,
    lng: -75.85785616189241,
}

const zoom = 17

export default function SimpleMap(){
  console.log("simple map render")
  return (
    <div style={{ height: '100vh', width: '100%' }}>
      <GoogleMapReact
        bootstrapURLKeys={{ key: THE_KEY }}
        defaultCenter={center}
        defaultZoom={zoom}
      >
        <AnyReactComponent
            lat={center.lat}
            lng={center.lng}
            text="My Marker"
            />
      </GoogleMapReact>
    </div>
  );
}

Screenshots 🖥
IMPORTANT: It always happens, in this gif it only happens the first two times, but it's because when converting video to gif the quality drops

ezgif com-gif-maker

Environment:

  • OS: windows
  • Browser chrome, mozilla, etc.
  • google-map-react: 2.1.10
  • react 18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions