visgl / visgl/react-map-gl

[Bug] `bearing` not supported for controlled components

Open
#2,210 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Description

According to docs,

When Map is used as a controlled component, event.viewState.bearing reflects the zoom that the camera "proposes" to change to, as a result of either user interaction or methods such as flyTo. The camera does not actually change until the application updates the bearing prop.

In reality, event.viewState.bearing reports the current bearing.

Expected Behavior

event.viewState.bearing from onRotate should return "proposed" bearing

Steps to Reproduce

https://codesandbox.io/s/exciting-currying-fv7z84?file=/src/App.js

Attempt to rotate, see console

Environment

See codesandbox

Logs

No response

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the rotation behavior in the linked CodeSandbox, then trace the controlled Map handling for the onRotate callback and event.viewState.bearing. Done means the callback reports the proposed bearing described in the documentation rather than the current bearing, with the behavior verified during rotation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.