react-leaflet icon indicating copy to clipboard operation
react-leaflet copied to clipboard

changing the center of react-leaflet on load page handled by api request map in version 4.

Open Abbosbek-cloud opened this issue 1 year ago • 1 comments

Bug report in v4

Before opening an issue, make sure to read the contributing guide and understand this is a bug tracker, not a support platform.

Please make sure to check the following boxes before submitting an issue.
Issues opened without using this template will be closed unless they have a good reason not to follow this template.

  • [ ] All peer dependencies are installed: React, ReactDOM and Leaflet.
  • [ ] Using the latest version of React and ReactDOM v18.
  • [ ] Using the supported version of Leaflet (v1.8.0 minimum) and its corresponding CSS file is loaded.
  • [ ] Using the latest v4 version of React-Leaflet.
  • [ ] The issue has not already been reported.
  • [ ] Make sure you have followed the quick start guide for Leaflet.
  • [ ] Make sure you have fully read the documentation and that you understand the limitations.

Expected behavior

Centering the <MapContainer />.

Actual behavior

I could not find a solution for centering the map when the coordinates come from the API. I tried to use useMap() hook but, it did not help me! I have coordinates in xxx API and after reading the coordinates I need to change the center position of the Map with a slower animation!

Steps to reproduce

Please provide the simplest example possible to reproduce the issue, based on this StackBlitz.

Abbosbek-cloud avatar Jun 27 '23 00:06 Abbosbek-cloud