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

Marker Anchor #1128

Closed
YousefED opened this issue Jun 10, 2020 · 1 comment
Closed

Marker Anchor #1128

YousefED opened this issue Jun 10, 2020 · 1 comment

Comments

@YousefED
Copy link

mapbox gl has support for advanced properties on Markers like anchor (https://docs.mapbox.com/mapbox-gl-js/api/markers/#Marker). I know we can achieve a similar effect with offset in react-map-gl markers, but I'd prefer to use a similar API.

As react-map-gl is presented as a "wrapper" around mapbox gl it surprised me a little bit to see custom implementations for markers, popups, etc. Is there any reason in particular for this? Why use customized implementations instead of 1-1 React wrappers around the underlying API?

@Pessimistress
Copy link
Collaborator

mapbox-gl's API does not support using it as a fully controlled React component. In short, because React and Mapbox run separate render loops, we cannot guarantee that the map and any other component in the React tree gets updated at the same time, unless we block the map from handling user input.

You can see some relevant discussion in this thread:

We have discussed this with the Mapbox dev team but they were not convinced of the value in our use case.

As for markers, we can probably use React Portal to better reuse the native control code, but will run into the same issue when they are draggable.

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