mariusandra / pigeon-maps

ReactJS Maps without external dependencies
https://pigeon-maps.js.org/
MIT License
3.44k stars 142 forks source link

Update the image when the center props change #145

Open tdimnet opened 2 years ago

tdimnet commented 2 years ago

Hey there,

first, thank you for your job with this library: it is so easy to use compared to other map librairies! However, I have a question about the behavior of your library.

I am displaying a marker on the map. Here is my code:

    const { latitude, longitude } = location

    return (
        <div>
            <Map height={300} center={[Number(latitude), Number(longitude)]} defaultZoom={11}>
                <Marker width={50} anchor={[Number(latitude), Number(longitude)]} />
            </Map>
        </div>
    )

I don't have any problems and everything works fine: my map is displayed and is centered around my marker

However, In my project, I can dynamically change the latitude and longitude. When they change, my marker is updated with the new location but my map doesn't change and stays on the old coordinates. Am I missing something?