Skip to content

TypeError: Cannot read property 'lat' of undefined #293

@undermuz

Description

@undermuz

The error occurs when you use "fitBounds" with "ne" and "sw"

import { fitBounds } from 'google-map-react/utils'
const size = {
                width: $( this.refs.mapWrapper ).width(),
                height: $( this.refs.mapWrapper ).height()
            }

const bounds = {
                ne: {
                    lat: NorthEast.lat(),
                    lng: NorthEast.lng()
                },
                sw: {
                    lat: SouthWest.lat(),
                    lng: SouthWest.lng()
                }
            }

const {center, zoom} = fitBounds(bounds, size)

In the folder with the module in the code I do not see the code for such a case, although it is in the readme:
http://joxi.ru/KAx91RZuMZlZJr

At the same time, I see support for such behavior here:
https://github.com/istarkov/google-map-react/blob/master/src/utils/utils.js

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