Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the image when the center props change #145

Open
tdimnet opened this issue Jan 5, 2022 · 0 comments
Open

Update the image when the center props change #145

tdimnet opened this issue Jan 5, 2022 · 0 comments

Comments

@tdimnet
Copy link

tdimnet commented Jan 5, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant