Skip to content

fix(MarkerView): forward pointerEvents prop to native view#4232

Open
mfazekas wants to merge 3 commits into
mainfrom
fix/marker-view-pointer-events
Open

fix(MarkerView): forward pointerEvents prop to native view#4232
mfazekas wants to merge 3 commits into
mainfrom
fix/marker-view-pointer-events

Conversation

@mfazekas

@mfazekas mfazekas commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #4219.

MarkerView accepted pointerEvents via ViewProps but never forwarded it to native, so pointerEvents="none" had no effect — the marker kept intercepting touches regardless.

iOS: Destructure pointerEvents from props and pass it to the native RNMBXMarkerView. Skip stopPropagation in onTouchEnd when pointerEvents is "none" or "box-none" for consistent JS event handling.

Android: RNMBXMarkerViewContent is added directly to Mapbox's ViewAnnotationManager (outside RN's view hierarchy), so Fabric's normal pointerEvents propagation doesn't reach it. Override setPointerEvents in RNMBXMarkerView to propagate the value, and in RNMBXMarkerViewContent.dispatchTouchEvent return false early when pointerEvents=NONE (also skipping the requestDisallowInterceptTouchEvent call that would otherwise keep the map from receiving touches).

Also updates the Marker View example to add a toggle for pointerEvents so the behavior can be verified interactively.

Repro
// Before: pointerEvents="none" silently ignored — marker blocks all map touches
<Mapbox.MarkerView coordinate={coord} pointerEvents="none">
  <MyView />
</Mapbox.MarkerView>

With this fix, pointerEvents="none" makes the marker transparent to all touch events, passing them through to the map below.

Miklós Fazekas added 3 commits June 21, 2026 16:02
MarkerView accepted pointerEvents via ViewProps but never destructured
or passed it to the native RNMBXMarkerView, so pointerEvents="none"
had no effect. Also skip stopPropagation in onTouchEnd when pointerEvents
is "none" or "box-none" so JS-level event handling stays consistent.

Fixes #4219
…ntent

RNMBXMarkerViewContent is added directly to Mapbox's ViewAnnotationManager
(separate from RN's view hierarchy), so setting pointerEvents on the parent
RNMBXMarkerView via Fabric had no effect on touch handling of the content view.

Override setPointerEvents in RNMBXMarkerView to propagate the value to the
content view. In RNMBXMarkerViewContent.dispatchTouchEvent, return false early
when pointerEvents=NONE so touches fall through to the map.
Fabric's codegen delegate (RNMBXMarkerViewManagerDelegate) does not
forward the standard pointerEvents ViewProp, so setPointerEvents on
RNMBXMarkerView was never called. Override updateProperties in the
ViewManager to read the prop from ReactStylesDiffMap and push it to
RNMBXMarkerViewContent via setContentPointerEvents.
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.

[Bug]: MarkerView pointerEvents="none" still block MapView

1 participant