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

Can't pan the map after enabling geolocation #1479

Closed
brandolori opened this issue May 29, 2021 · 2 comments
Closed

Can't pan the map after enabling geolocation #1479

brandolori opened this issue May 29, 2021 · 2 comments
Labels

Comments

@brandolori
Copy link

brandolori commented May 29, 2021

Description

After activating geolocation via the GeolocateControl component, the map stops being able to be panned. It does not respond to touch or mouse events. Markers are still interactable, and the pointer still displays the interaction cursor (the hand)

Repro Steps

  1. Open the map
  2. Click / tap on the GeolocateControl
  3. Wait for geolocation
  4. After a position has been tracked, the viewport will sometimes move to the tracked location, sometimes not. Either way, the user can no longer change the viewport of the map, neither by dragging nor by pinch-to-zoom

Here's a repository that presents the issue:
https://github.com/brandolori/react-map-gl-repro

Environment (please complete the following information):

  • Library Version: react-map-gl 6.1.15
  • Mapbox Version: mapbox-gl 2.3.0
  • React Version: react 17.0.1
  • Browser Version: Chrome 90, Firefox 88
  • OS: Windows 10, Android 10

Logs

No relevant errors or warnings in the console.

@brandolori brandolori added the bug label May 29, 2021
@Pessimistress
Copy link
Collaborator

Thanks for reporting. GeolocateControl triggers onViewportChange callback with an extra nextViewport.onViewportChange field which overrides your own callback. Before a fix is published you can work around this by swapping the order of your props assignment ({...viewport} {...props}).

@Pessimistress
Copy link
Collaborator

Fix published in v5.3.16/v6.1.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants