Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MarkerView clipping issue on Android #3769

Open
unendingblue opened this issue Feb 9, 2025 · 0 comments
Open

[Bug]: MarkerView clipping issue on Android #3769

unendingblue opened this issue Feb 9, 2025 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@unendingblue
Copy link

unendingblue commented Feb 9, 2025

Mapbox Implementation

Mapbox

Mapbox Version

11.9.0

React Native Version

0.76.5

Platform

Android

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React from 'react';
import { View } from 'react-native';
import { MapView, MarkerView } from '@rnmapbox/maps';

const MarkerTestMap = () => {
  return (
    <MapView>
      <MarkerView coordinate={[0, -60]}>
        <View style={{ width: 100, aspectRatio: 1, backgroundColor: 'red' }}>
          <View style={{ position: 'absolute', top: -50, width: 100, height: 25, backgroundColor: 'green' }} />
        </View>
      </MarkerView>
    </MapView>
  );
};

Observed behavior and steps to reproduce

Children that are placed outside of a MarkerView's bounds (via absolute positioning) are clipped on Android. This issue is not present on iOS.

iOS Android
Image Image

Expected behavior

Absolute positioned views should be drawn even past the MarkerView's bounds.

Notes / preliminary analysis

I'm not familiar with native development, but I believe the root of the issue is here:

if (inAdd) {
val w = if (widthMeasureSpec == 0) {
MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY)
} else {
widthMeasureSpec
};
val h = if (heightMeasureSpec == 0) {
MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY)
} else {
heightMeasureSpec
}
super.onMeasure(w, h)
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
}

MeasureSpec.EXACTLY prevents children past the bounds be drawn, and unfortunately using MeasureSpec.UNSPECIFIED results in the following error: A catalyst view must have an explicit width and height given to it.

Additional links and references

#3235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant