-
Notifications
You must be signed in to change notification settings - Fork 2
App crashes on Android when a custom React Native view is rendered as a child of Marker. #61
Description
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
App crashes on Android when a custom React Native view is rendered as a child of Marker.
The crash occurs due to an IllegalArgumentException: parameter must be a descendant of this view thrown from Android's accessibility/content capture system (ViewGroup.offsetRectBetweenParentAndChild). This happens because the native marker view detaches or re-parents the child view during rendering, leaving a stale reference in the Android view hierarchy.
The crash does NOT occur when Marker has no children (default pin). It only happens when passing a custom child view.
Workarounds attempted (none resolved the issue):
- Wrapping child in
<View importantForAccessibility="no-hide-descendants"> - Wrapping child in
<View collapsable={false}> - Both combined
Stack trace:
java.lang.IllegalArgumentException: parameter must be a descendant of this view
android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:6467)
android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:6396)
android.view.ViewGroup$ViewLocationHolder.init(ViewGroup.java:9509)
...
com.facebook.react.views.view.ReactViewGroup.addChildrenForAccessibility(ReactViewGroup.kt:1047)
android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:3940)
Library version
1.0.0-beta.8
Environment info
System:
OS: macOS 26.3.1
CPU: (10) arm64 Apple M1 Max
Memory: 166.72 MB / 32.00 GB
Shell: 5.9 /bin/zsh
Binaries:
Node: 24.14.0
npm: 11.9.0
Watchman: 2025.08.18.00
Managers:
CocoaPods: 1.16.2
SDKs:
iOS SDK: iOS 26.2
Xcode: 26.3 / 17C529
npmPackages:
react: 19.2.0
react-native: 0.83.2
iOS:
hermesEnabled: true
newArchEnabled: trueSteps to reproduce
- Render a
MapViewwith one or moreMarkercomponents - Pass any custom React Native view as a child of
Marker(e.g. an SVG icon or an)
- Run on Android (physical device or emulator)
- The app crashes immediately on render with IllegalArgumentException
import { MapView, Marker } from "@lugg/maps";
import { View, Text } from "react-native";
export default function App() {
return (
<MapView
style={{ flex: 1 }}
initialCoordinate={{ latitude: 41.387, longitude: 2.1701 }}
>
<Marker coordinate={{ latitude: 41.387, longitude: 2.1701 }}>
{/* Any custom child causes the crash on Android */}
<View style={{ width: 22, height: 28, backgroundColor: "red" }} />
</Marker>
</MapView>
);
}