Skip to content

Android longPress to initiate PointAnnotation draggable - #4267

Open
lochstar wants to merge 1 commit into
rnmapbox:mainfrom
lochstar:android-longpress-draggable-pointannotation
Open

lochstar wants to merge 1 commit into
rnmapbox:mainfrom
lochstar:android-longpress-draggable-pointannotation

Conversation

@lochstar

@lochstar lochstar commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

This change is based on an old discussion at #3425.

When multiple draggable PointAnnotation are visible on a pan-able map, it is very easy to accidentally trigger the drag event of the PointAnnotation whilst moving around the map.

This issue only exists on Android, iOS already implements a long-press to start the drag. This PR aligns the behaviour.

A prop has been added to restore the current Android behaviour: androidInstantDraggable. I've added a toggle to the example app on the "Show Point Annotation" page to test the behaviour.

How to verify

Android only: Example App > Annotations > Show Point Annotation:

  • tap selects, longPress then drag triggers the events: onDragStart, onDrag, onDragEnd
  • toggle the "Android: Instant draggable" switch to observe the old/instant drag behaviour.

Whilst testing in the example app, I noticed there is a crash when pressing "Render Polygon above", fix is here: #4362

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

@lochstar
lochstar had a problem deploying to CI with Mapbox Tokens July 30, 2026 00:59 — with GitHub Actions Failure
@lochstar
lochstar had a problem deploying to CI with Mapbox Tokens July 30, 2026 00:59 — with GitHub Actions Failure
@lochstar
lochstar had a problem deploying to CI with Mapbox Tokens July 30, 2026 00:59 — with GitHub Actions Failure

@mfazekas mfazekas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lochstar, this makes sense. Requiring a long-press before dragging a PointAnnotation on Android avoids accidental drags while panning, and matches iOS, so I'm happy for it to become the Android default.

Two requests before we merge:

  1. Please add an option to opt back into the current behaviour, where a draggable annotation starts dragging right away without a long-press. Some apps rely on that, so they need a way to keep it.
  2. Please move the RNMBXFillLayerManager aboveLayerID/belowLayerID null-handling fix into its own PR. It looks good, but it's unrelated, and keeping it separate makes both easier to review and revert.

Thanks again!

@lochstar
lochstar force-pushed the android-longpress-draggable-pointannotation branch from 011afe3 to 6cf2878 Compare October 15, 2026 21:13
@lochstar

Copy link
Copy Markdown
Contributor Author

Hey @mfazekas, thanks for checking this one out. I've made the requested changes. Let me know if you'd like anything else changed.
Cheers!

This branch had an error being deployed

1 failed (outdated) deployment
CI with Mapbox Tokens — 011afe38 Deployed Jul 30, 2026 by lochstar via CI requiring tokens / Web/Mapbox / Example Build for Web #1152
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

Successfully merging this pull request may close these issues.

2 participants