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

Why are markers required? #94

Open
jjavierdguezas opened this issue Jul 12, 2021 · 1 comment
Open

Why are markers required? #94

jjavierdguezas opened this issue Jul 12, 2021 · 1 comment

Comments

@jjavierdguezas
Copy link

jjavierdguezas commented Jul 12, 2021

First, thanks for this package!

I just want to display a map, centered in a location but I am getting "Component must have `Marker`, `Path` or `Direction` child" error

Google docs says that markers are optional
image

so, why are they required? can we please make them optional?

@DaddyWarbucks
Copy link
Collaborator

DaddyWarbucks commented Jul 12, 2021

This makes sense. The StaticGoogleMap should probably support this case. We have outlined a couple of things that we would like to add to a V2 and this seems like one of those things. But there is no timeline on V2. Could you try this

const Blank = () => '';
<StaticGoogleMap center={...}>
  <Blank />
</StaticGoogleMap>

// or even
<StaticGoogleMap center={...}>
  {() => ''}
</StaticGoogleMap>

The StaticGoogleMap can take a component that is not one exported from this lib. The child components actually do not "render" any HTML but instead return additional query params to add the the URL for the map. By giving it a component that returns an empty string, I believe you will get the result you are looking for.

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