[Feat] Custom style to MapControl

Open
#776 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start at the MapControl component and its current control styling and positioning behavior. Determine how a custom style could set values such as bottom without depending on the first control in a position, then verify that styling works when multiple controls share positions.

Written by the indexing model from the issue text.

Description

Target Use Case

I'm trying to make a "full height" MapControl.

Image
Proposal

Ideally I would be able to pass in a custom style to the component, setting {bottom: "0px"}.

I managed with a workaround that seems very fragile:

  const map = useMap();

  useEffect(() => {
    const control = map?.controls[position].getAt(0);
    if (control?.style)
      control.style.bottom = "0px";
  }, [map, position]);

which works because it's the only component I will have in that position, but any other position I'm screwed 😅

Dominant language
TypeScript
Stars
2k
Forks
195
Avg merge
6h 26m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from visgl/react-google-maps

All issues in visgl/react-google-maps

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.