Skip to content

Create dedicated Compass component #2402

Closed

Description

@naftalibeder

Using the MapView's compassImage property to display a custom compass produces some challenges:

  • Dynamically sizing the compass is impossible - the source image is displayed at its original size
  • Shadow needs to be "baked into" the image file, meaning that if the image rotates, the shadow rotates with it.
  • Any animation in the compass image is impossible - it's a static image.

(Discussed in #2352.)

The obvious solution would be to display a React Native view, and use the map's heading to rotate it. This is something you could easily do in a native app, but the React Native bridge bottleneck makes it unworkable - even with debouncing/optimizations, the lag is really bad.

I did a quick proof of concept that shows how we could provide a <Compass /> component that does nothing except render children and rotate according to the map rotation, as shown.

Screen.Recording.2022-11-02.at.4.08.45.PM.mov

Activity

  1. self-assigned this
    on Nov 10, 2022
  2. changed the title [-][Feature] Create dedicated `Compass` component[/-] [+]Create dedicated `Compass` component[/+] on Nov 10, 2022
  3. locked and limited conversation to collaborators on Apr 2, 2023
  4. converted this issue into a discussion #2762 on Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions