react-native-maps 1.29.3 → 1.29.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ import android.graphics.drawable.Animatable;
9
9
  import android.graphics.drawable.Drawable;
10
10
  import android.net.Uri;
11
11
  import android.view.View;
12
+ import android.view.ViewGroup;
12
13
  import android.widget.LinearLayout;
13
14
  import android.animation.ObjectAnimator;
14
15
  import android.util.Property;
@@ -658,6 +659,22 @@ public class MapMarker extends MapFeature {
658
659
 
659
660
  private Bitmap mLastBitmapCreated = null;
660
661
 
662
+ // Walks the subtree to find the union of descendant bounds for bitmap sizing.
663
+ // Uses only laid-out dimensions — do NOT call View#measure() here (Fabric assertion).
664
+ private void expandSnapshotSizeFromSubtree(View view, int offsetX, int offsetY, int[] outWh) {
665
+ int w = view.getWidth() > 0 ? view.getWidth() : view.getMeasuredWidth();
666
+ int h = view.getHeight() > 0 ? view.getHeight() : view.getMeasuredHeight();
667
+ outWh[0] = Math.max(outWh[0], offsetX + w);
668
+ outWh[1] = Math.max(outWh[1], offsetY + h);
669
+ if (view instanceof ViewGroup) {
670
+ ViewGroup group = (ViewGroup) view;
671
+ for (int i = 0; i < group.getChildCount(); i++) {
672
+ View child = group.getChildAt(i);
673
+ expandSnapshotSizeFromSubtree(child, offsetX + child.getLeft(), offsetY + child.getTop(), outWh);
674
+ }
675
+ }
676
+ }
677
+
661
678
  private void clearDrawableCache() {
662
679
  mLastBitmapCreated = null;
663
680
  }
@@ -666,6 +683,27 @@ public class MapMarker extends MapFeature {
666
683
  int width = this.width <= 0 ? 100 : this.width;
667
684
  int height = this.height <= 0 ? 100 : this.height;
668
685
 
686
+ // Bitmap must cover laid-out custom-marker subtree; Yoga box alone can be too small (Fabric).
687
+ if (hasCustomMarkerView) {
688
+ int[] expanded = new int[] { width, height };
689
+ for (int i = 0; i < getChildCount(); i++) {
690
+ View child = getChildAt(i);
691
+ if (child instanceof MapCallout) {
692
+ continue;
693
+ }
694
+ expandSnapshotSizeFromSubtree(child, child.getLeft(), child.getTop(), expanded);
695
+ }
696
+ width = expanded[0];
697
+ height = expanded[1];
698
+ }
699
+
700
+ if (width <= 0) {
701
+ width = 100;
702
+ }
703
+ if (height <= 0) {
704
+ height = 100;
705
+ }
706
+
669
707
  // Do not create the doublebuffer-bitmap each time. reuse it to save memory.
670
708
  Bitmap bitmap = mLastBitmapCreated;
671
709
 
@@ -245,6 +245,10 @@ id regionAsJSON(MKCoordinateRegion region) {
245
245
  #pragma clang diagnostic push
246
246
  #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
247
247
  - (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
248
+ if (subview == nil) {
249
+ return;
250
+ }
251
+
248
252
  // Our desired API is to pass up markers/overlays as children to the mapview component.
249
253
  // This is where we intercept them and do the appropriate underlying mapview action.
250
254
  if ([subview isKindOfClass:[AIRGoogleMapMarker class]]) {
@@ -290,7 +294,9 @@ id regionAsJSON(MKCoordinateRegion region) {
290
294
  [self insertReactSubview:(UIView *)childSubviews[i] atIndex:atIndex];
291
295
  }
292
296
  }
293
- [_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
297
+ NSUInteger safeIndex = atIndex < 0 ? 0 : (NSUInteger)atIndex;
298
+ safeIndex = MIN(safeIndex, _reactSubviews.count);
299
+ [_reactSubviews insertObject:(UIView *)subview atIndex:safeIndex];
294
300
  }
295
301
  #pragma clang diagnostic pop
296
302
 
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "types": "dist/src/index.d.ts",
8
8
  "author": "Leland Richardson <leland.m.richardson@gmail.com>",
9
9
  "homepage": "https://github.com/react-native-maps/react-native-maps#readme",
10
- "version": "1.29.3",
10
+ "version": "1.29.5",
11
11
  "license": "MIT",
12
12
  "scripts": {
13
13
  "lint": "eslint . --max-warnings 0",