react-native-maps 1.26.5 → 1.26.7

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.
@@ -1137,10 +1137,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1137
1137
 
1138
1138
  // Remove from a view group if already present, prevent "specified child
1139
1139
  // already had a parent" error.
1140
- ViewGroup annotationParent = (ViewGroup) annotation.getParent();
1141
- if (annotationParent != null) {
1142
- annotationParent.removeView(annotation);
1143
- }
1140
+ safeRemoveFromParent(annotation);
1144
1141
 
1145
1142
  // Ensure attacherGroup is not null before using it
1146
1143
  if (attacherGroup == null) {
@@ -1225,7 +1222,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1225
1222
  if (feature instanceof MapMarker) {
1226
1223
  markerMap.remove(feature.getFeature());
1227
1224
  feature.removeFromMap(markerCollection);
1228
- attacherGroup.removeView(feature);
1225
+ safeRemoveFeatureFromAttacherGroup(feature);
1229
1226
  } else if (feature instanceof MapHeatmap) {
1230
1227
  heatmapMap.remove(feature.getFeature());
1231
1228
  feature.removeFromMap(map);
@@ -1563,12 +1560,12 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1563
1560
 
1564
1561
  switch (action) {
1565
1562
  case (MotionEvent.ACTION_DOWN):
1566
- this.getParent().requestDisallowInterceptTouchEvent(
1563
+ safeRequestDisallowInterceptTouchEvent(
1567
1564
  map != null && map.getUiSettings().isScrollGesturesEnabled());
1568
1565
  break;
1569
1566
  case (MotionEvent.ACTION_UP):
1570
1567
  // Clear this regardless, since isScrollGesturesEnabled() may have been updated
1571
- this.getParent().requestDisallowInterceptTouchEvent(false);
1568
+ safeRequestDisallowInterceptTouchEvent(false);
1572
1569
  break;
1573
1570
  }
1574
1571
  super.dispatchTouchEvent(ev);
@@ -1656,14 +1653,14 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1656
1653
 
1657
1654
  private void removeCacheImageView() {
1658
1655
  if (this.cacheImageView != null) {
1659
- ((ViewGroup) this.cacheImageView.getParent()).removeView(this.cacheImageView);
1656
+ safeRemoveFromParent(this.cacheImageView);
1660
1657
  this.cacheImageView = null;
1661
1658
  }
1662
1659
  }
1663
1660
 
1664
1661
  private void removeMapLoadingProgressBar() {
1665
1662
  if (this.mapLoadingProgressBar != null) {
1666
- ((ViewGroup) this.mapLoadingProgressBar.getParent()).removeView(this.mapLoadingProgressBar);
1663
+ safeRemoveFromParent(this.mapLoadingProgressBar);
1667
1664
  this.mapLoadingProgressBar = null;
1668
1665
  }
1669
1666
  }
@@ -1671,7 +1668,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1671
1668
  private void removeMapLoadingLayoutView() {
1672
1669
  this.removeMapLoadingProgressBar();
1673
1670
  if (this.mapLoadingLayout != null) {
1674
- ((ViewGroup) this.mapLoadingLayout.getParent()).removeView(this.mapLoadingLayout);
1671
+ safeRemoveFromParent(this.mapLoadingLayout);
1675
1672
  this.mapLoadingLayout = null;
1676
1673
  }
1677
1674
  }
@@ -1911,4 +1908,52 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1911
1908
  }
1912
1909
  };
1913
1910
 
1911
+ /**
1912
+ * Safely removes a view from its parent ViewGroup.
1913
+ * Prevents NullPointerException during component lifecycle operations.
1914
+ *
1915
+ * @param view The view to remove from its parent
1916
+ * @return true if the view was successfully removed, false otherwise
1917
+ */
1918
+ private boolean safeRemoveFromParent(View view) {
1919
+ if (view != null) {
1920
+ ViewGroup parent = (ViewGroup) view.getParent();
1921
+ if (parent != null) {
1922
+ parent.removeView(view);
1923
+ return true;
1924
+ }
1925
+ }
1926
+ return false;
1927
+ }
1928
+
1929
+ /**
1930
+ * Safely requests touch event handling from parent ViewGroup.
1931
+ * Prevents NullPointerException during touch event dispatching.
1932
+ *
1933
+ * @param disallowIntercept Whether to disallow parent touch interception
1934
+ * @return true if the request was successfully made, false otherwise
1935
+ */
1936
+ private boolean safeRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
1937
+ ViewGroup parent = (ViewGroup) this.getParent();
1938
+ if (parent != null) {
1939
+ parent.requestDisallowInterceptTouchEvent(disallowIntercept);
1940
+ return true;
1941
+ }
1942
+ return false;
1943
+ }
1944
+
1945
+ /**
1946
+ * Safely removes a MapFeature from the attacherGroup.
1947
+ * Prevents NullPointerException during feature removal operations.
1948
+ *
1949
+ * @param feature The MapFeature to remove from attacherGroup
1950
+ * @return true if the feature was successfully removed, false otherwise
1951
+ */
1952
+ private boolean safeRemoveFeatureFromAttacherGroup(MapFeature feature) {
1953
+ if (attacherGroup != null && feature != null) {
1954
+ attacherGroup.removeView(feature);
1955
+ return true;
1956
+ }
1957
+ return false;
1958
+ }
1914
1959
  }
@@ -131,7 +131,7 @@ using namespace facebook::react;
131
131
  _view = (AIRMap *)[_legacyMapManager view];
132
132
 
133
133
  self.contentView = _view;
134
-
134
+
135
135
  _view.onLongPress = [self](NSDictionary* dictionary) {
136
136
  if (_eventEmitter) {
137
137
  // Extract values from the NSDictionary
@@ -277,6 +277,13 @@ using namespace facebook::react;
277
277
  facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
278
278
  .latitude = [coordinateDict[@"latitude"] doubleValue],
279
279
  .longitude = [coordinateDict[@"longitude"] doubleValue],
280
+ .altitude =[coordinateDict[@"altitude"] doubleValue],
281
+ .timestamp =[coordinateDict[@"timestamp"] doubleValue],
282
+ .accuracy =[coordinateDict[@"accuracy"] floatValue],
283
+ .speed =[coordinateDict[@"speed"] floatValue],
284
+ .heading =[coordinateDict[@"heading"] floatValue],
285
+ .altitudeAccuracy =[coordinateDict[@"altitudeAccuracy"] floatValue],
286
+
280
287
  };
281
288
  NSString* str = @"";
282
289
  if (errorDict){
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "src/index.ts",
6
6
  "author": "Leland Richardson <leland.m.richardson@gmail.com>",
7
7
  "homepage": "https://github.com/react-native-maps/react-native-maps#readme",
8
- "version": "1.26.5",
8
+ "version": "1.26.7",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",