PaulLeCam / react-leaflet

React components for Leaflet maps
https://react-leaflet.js.org
Other
5.18k stars 888 forks source link

Problem with bounds and ajax loading #588

Closed cekk closed 5 years ago

cekk commented 5 years ago

I'm using react-leaflet in some CMS-generated pages and it works smoothly.

I have a simple component that shows some points in the map and i pass that list of points to the map as bounds:

`

`

There is only a use-case where i can't draw the correct map boundaries: when in a page I have a js script where i get the html from another page and insert it into the current page (it's an ajax call with jquery "load" method).

The react app works correctly, i see the list of markers in the map, but boundaries seems not correctly calculated.

My suspect is that with that ajax call, the map can't calculate the map dimension and bounds corrrectly. Do you have any suggestions?

PaulLeCam commented 5 years ago

Hi, Please only use GitHub issues to report possible bugs in the library. You can use the react-leaflet tag in StackOverflow for questions related to using it.