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

Suggestion: convert the center/marker input coords to numbers #171

Open
bnbon opened this issue Oct 9, 2022 · 1 comment
Open

Suggestion: convert the center/marker input coords to numbers #171

bnbon opened this issue Oct 9, 2022 · 1 comment

Comments

@bnbon
Copy link

bnbon commented Oct 9, 2022

Hello,

Great component, just realised what my final bug was – the values passed in were strings; so now I just appended a + to the values, but seems fair to suggest that the component should convert strings to numbers anyway

My fix was:

  const [center, setCenter] = useState([+lat, +lon]);
  const [marker] = useState([+lat, +lon]);
@hydrandt
Copy link

Thanks for this bugreport. Indeed, passing latitude and longitude to the Map component as center or defaultCenter as string, the map moves to the expected coordinates, giving you the feeling that everything's fine. But the Marker component doesn't deal with this and silently does nothing.

So, if you are facing this issue, doublecheck that you're passing [Number, Number] to the Marker component as the anchor prop:)

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

2 participants