-
-
Notifications
You must be signed in to change notification settings - Fork 937
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:
- The Pressability bounding box in the shadow tree becomes smaller and left-aligned compared to the actual rendered position
- Touch events on the left side of centered marker content become unresponsive
- 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 [Bug]: [Android] [newArch] MarkerView Pressable onPress does not work #3832 (onPress not firing at all on Android new arch)
flex: 0alone is sufficient to prevent the container from expanding;alignSelf: 'flex-start'is the problematic part