Skip to content

Map Pins are not positioned correctly after zoom or pan聽#1204

Description

@ruthoferroman

Describe the bug 馃悰

My map pins are rendered on the correct position initally. They aren't positioned correct as soon as i zoom or pan the map.

To Reproduce 馃攳

Steps to reproduce the behavior:

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

const AnyReactComponent = ({ text }) => <div style={{
  color: 'white', 
  background: 'grey',
  padding: '15px 10px',
  display: 'inline-flex',
  textAlign: 'center',
  alignItems: 'center',
  justifyContent: 'center',
  borderRadius: '100%',
  transform: 'translate(-50%, -50%)'
}}>{text}</div>;

export default class SimpleMap extends React.Component { 
  static defaultProps = {
    center: {lat: 59.95, lng: 30.33},
    zoom: 11
  };
  render() {
  return (
    // Important! Always set the container height explicitly
    <div style={{ height: '200px', width: '200px' }}>
      <GoogleMapReact
        bootstrapURLKeys={{ key: "xxx" }}
        defaultCenter={this.props.center}
        defaultZoom={this.props.zoom}
      >
        <AnyReactComponent 
          lat={59.955413} 
          lng={30.337844} 
          text={'Kreyser Avrora'} 
        />
      
      </GoogleMapReact>
    </div>
  );}
}

Expected behavior 馃挱

Map Pins shall be repositioned according to their langitude and lotitude properties after zoom or pan.

Environment:

  • OS: windows
  • Browser: edge

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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