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

Add Marker by click on MapGL #277

Open
itwaze opened this issue Jan 26, 2020 · 0 comments
Open

Add Marker by click on MapGL #277

itwaze opened this issue Jan 26, 2020 · 0 comments

Comments

@itwaze
Copy link

itwaze commented Jan 26, 2020

Hi @stepankuzmin

I cannot add a marker by clicking on a map using your library. For example, by clicking I want to add input and write something in it.

And marker position fix:

  const [markerData, setMarkerData] = useState(null);
  
  const markerPositionFix = React.useRef(null);

  React.useEffect(() => {

    if (markerPositionFix.current !== null)
      markerPositionFix.current._el.style.width = "fit-content";

  }, [markerData]);

  <MapGL onClick={({ lngLat }) => setMarkerData(lngLat)} {...options} />

https://codesandbox.io/s/peaceful-taussig-r980y - urbica
https://codesandbox.io/s/react-map-gl-markers-demo-m2bqr - uber

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