react-native-maps 1.29.4 → 1.29.6

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.
@@ -193,7 +193,9 @@ public class MapManager extends ViewGroupManager<MapView> {
193
193
  }
194
194
 
195
195
  view.applyBaseMapPadding(left, top, right, bottom);
196
- view.map.setPadding(left, top, right, bottom);
196
+ if (view.map != null) {
197
+ view.map.setPadding(left, top, right, bottom);
198
+ }
197
199
  }
198
200
 
199
201
  @ReactProp(name = "showsUserLocation", defaultBoolean = false)
@@ -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
 
@@ -1363,7 +1363,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1363
1363
  }
1364
1364
 
1365
1365
  public void updateExtraData(Object extraData) {
1366
- if (setPaddingDeferred && super.getHeight() > 0 && super.getWidth() > 0) {
1366
+ if (setPaddingDeferred && map != null && super.getHeight() > 0 && super.getWidth() > 0) {
1367
1367
  CameraUpdate cu = CameraUpdateFactory.newCameraPosition(map.getCameraPosition());
1368
1368
 
1369
1369
  map.setPadding(edgeLeftPadding + baseLeftMapPadding,
@@ -1530,8 +1530,9 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1530
1530
  int edgeBottomPadding;
1531
1531
 
1532
1532
  public void applyBaseMapPadding(int left, int top, int right, int bottom) {
1533
- if (super.getHeight() <= 0 || super.getWidth() <= 0) {
1534
- // the map is not laid out yet and calling setPadding() now has no effect
1533
+ if (map == null || super.getHeight() <= 0 || super.getWidth() <= 0) {
1534
+ // the map is not ready or not laid out yet and calling setPadding() now
1535
+ // has no effect, or crashes when the GoogleMap instance does not exist
1535
1536
  baseLeftMapPadding = left;
1536
1537
  baseRightMapPadding = right;
1537
1538
  baseTopMapPadding = top;
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.4",
10
+ "version": "1.29.6",
11
11
  "license": "MIT",
12
12
  "scripts": {
13
13
  "lint": "eslint . --max-warnings 0",