rnmapbox / rnmapbox/maps

[Bug]: MarkerView contentContainer alignSelf:'flex-start' causes touch dead zones

Open Beginner friendly
#4,181 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

Mapbox Implementation

Mapbox

Mapbox Version

11.18.2

React Native Version

0.79.2

Platform

iOS, Android

@rnmapbox/maps version

10.3.0

Standalone component to reproduce
import React from 'react';
import { View, TouchableWithoutFeedback, Text } from 'react-native';
import Mapbox from '@rnmapbox/maps';

function App() {
  return (
    <Mapbox.MapView style={{ flex: 1 }}>
      <Mapbox.Camera centerCoordinate={[139.7, 35.68]} zoomLevel={14} />
      <Mapbox.MarkerView coordinate={[139.7, 35.68]}>
        <TouchableWithoutFeedback onPress={() => console.log('press')}>
          <View style={{ width: 200, alignItems: 'center' }}>
            <View style={{ backgroundColor: 'white', padding: 8, borderRadius: 8 }}>
              <Text>Tap me</Text>
            </View>
          </View>
        </TouchableWithoutFeedback>
      </Mapbox.MarkerView>
    </Mapbox.MapView>
  );
}
Observed behavior and steps to reproduce

In v10.3.0, MarkerView.tsx applies contentContainer: { flex: 0, alignSelf: 'flex-start' } to RNMBXMakerViewContentComponent (line 170).

https://github.com/rnmapbox/maps/blob/main/src/components/MarkerView.tsx#L170

This was added for Fabric (New Architecture) support to sync setTranslationX/Y with the shadow tree. However, alignSelf: 'flex-start' causes the container to shrink to content width and align to the left edge. As a result:

  1. The Pressability bounding box in the shadow tree becomes smaller and left-aligned compared to the actual rendered position
  2. Touch events on the left side of centered marker content become unresponsive
  3. The area where touch is "dead" blocks map gestures (pan, zoom) as well — the touches are swallowed by the MarkerView's native container but don't reach the React children

This affects any MarkerView whose children are centered or have padding/margins.

Expected behavior

Touch should work across the entire visible area of MarkerView children. Map gestures should pass through areas not covered by marker content.

Removing alignSelf: 'flex-start' from contentContainer (keeping only flex: 0) fixes the issue without breaking the Fabric positioning logic.

Notes
  • Related but distinct from #3832 (onPress not firing at all on Android new arch)
  • flex: 0 alone is sufficient to prevent the container from expanding; alignSelf: 'flex-start' is the problematic part

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 in src/components/MarkerView.tsx at the contentContainer definition around line 170, then run the provided MarkerView reproduction on iOS and Android. Verify that centered or padded marker content receives touches across its visible area and that uncovered areas still allow map gestures after removing the problematic alignment.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.