Skip to content

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

@izuchy

Description

@izuchy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions