react-native-maps 1.26.14 → 1.26.16
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.
package/android/build.gradle
CHANGED
|
@@ -58,7 +58,7 @@ android {
|
|
|
58
58
|
|
|
59
59
|
defaultConfig {
|
|
60
60
|
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
61
|
-
targetSdkVersion safeExtGet('targetSdkVersion',
|
|
61
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 35)
|
|
62
62
|
|
|
63
63
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
64
64
|
|
|
@@ -39,6 +39,7 @@ import com.rnmaps.maps.MapOverlay;
|
|
|
39
39
|
import com.rnmaps.maps.MapView;
|
|
40
40
|
import com.rnmaps.maps.SizeReportingShadowNode;
|
|
41
41
|
|
|
42
|
+
import java.util.List;
|
|
42
43
|
import java.util.Map;
|
|
43
44
|
|
|
44
45
|
@ReactModule(name = MapViewManager.REACT_CLASS)
|
|
@@ -318,12 +319,21 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
318
319
|
|
|
319
320
|
@Override
|
|
320
321
|
public void addView(MapView parent, View child, int index) {
|
|
322
|
+
parent.addFeature(child, index);
|
|
321
323
|
if (child instanceof MapMarker && ((MapMarker) child).isLoadingImage()){
|
|
322
|
-
|
|
323
|
-
|
|
324
|
+
MapMarker markerView = (MapMarker) child;
|
|
325
|
+
// Marker is already added as invisible, restore visibility when image loads
|
|
326
|
+
markerView.setImageLoadedListener((uri, drawable, b) -> {
|
|
327
|
+
com.google.android.gms.maps.model.Marker googleMarker =
|
|
328
|
+
(com.google.android.gms.maps.model.Marker) markerView.getFeature();
|
|
329
|
+
if (googleMarker != null) {
|
|
330
|
+
// Restore original visibility (marker was hidden temporarily during image load)
|
|
331
|
+
if (View.VISIBLE == markerView.getVisibility()) {
|
|
332
|
+
googleMarker.setVisible(true);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
markerView.update(true);
|
|
324
336
|
});
|
|
325
|
-
} else {
|
|
326
|
-
parent.addFeature(child, index);
|
|
327
337
|
}
|
|
328
338
|
}
|
|
329
339
|
|
|
@@ -665,7 +665,6 @@ public class MapMarker extends MapFeature {
|
|
|
665
665
|
private Bitmap createDrawable() {
|
|
666
666
|
int width = this.width <= 0 ? 100 : this.width;
|
|
667
667
|
int height = this.height <= 0 ? 100 : this.height;
|
|
668
|
-
this.buildDrawingCache();
|
|
669
668
|
|
|
670
669
|
// Do not create the doublebuffer-bitmap each time. reuse it to save memory.
|
|
671
670
|
Bitmap bitmap = mLastBitmapCreated;
|
|
@@ -14,6 +14,7 @@ import androidx.lifecycle.DefaultLifecycleObserver;
|
|
|
14
14
|
import androidx.lifecycle.LifecycleOwner;
|
|
15
15
|
|
|
16
16
|
import android.os.Bundle;
|
|
17
|
+
import android.util.Log;
|
|
17
18
|
import android.view.GestureDetector;
|
|
18
19
|
import android.view.MotionEvent;
|
|
19
20
|
import android.view.View;
|
|
@@ -90,7 +91,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
90
91
|
GoogleMap.OnMarkerDragListener, OnMapReadyCallback, GoogleMap.OnPoiClickListener, GoogleMap.OnIndoorStateChangeListener, DefaultLifecycleObserver {
|
|
91
92
|
public GoogleMap map;
|
|
92
93
|
private Bundle savedMapState;
|
|
93
|
-
private
|
|
94
|
+
private ArrayList<MapFeature> savedFeatures = null;
|
|
94
95
|
private boolean shouldRestorePadding = false;
|
|
95
96
|
|
|
96
97
|
private MarkerManager markerManager;
|
|
@@ -140,7 +141,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
140
141
|
private static final String[] PERMISSIONS = new String[]{
|
|
141
142
|
"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"};
|
|
142
143
|
|
|
143
|
-
private final
|
|
144
|
+
private final List<MapFeature> features = new ArrayList<>();
|
|
144
145
|
private final Map<Marker, MapMarker> markerMap = new HashMap<>();
|
|
145
146
|
private final Map<Polyline, MapPolyline> polylineMap = new HashMap<>();
|
|
146
147
|
private final Map<Polygon, MapPolygon> polygonMap = new HashMap<>();
|
|
@@ -228,16 +229,16 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
228
229
|
|
|
229
230
|
@Override
|
|
230
231
|
public void onPause(LifecycleOwner owner) {
|
|
231
|
-
super.onPause();
|
|
232
232
|
if (hasPermissions() && map != null) {
|
|
233
233
|
//noinspection MissingPermission
|
|
234
234
|
map.setMyLocationEnabled(false);
|
|
235
235
|
}
|
|
236
236
|
synchronized (MapView.this) {
|
|
237
|
-
if (!
|
|
237
|
+
if (!paused) {
|
|
238
|
+
super.onPause();
|
|
238
239
|
MapView.this.onPause();
|
|
240
|
+
paused = true;
|
|
239
241
|
}
|
|
240
|
-
paused = true;
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
|
|
@@ -317,6 +318,12 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
317
318
|
@Override
|
|
318
319
|
protected void onAttachedToWindow() {
|
|
319
320
|
super.onAttachedToWindow();
|
|
321
|
+
|
|
322
|
+
// Reset lifecycle flags when reattaching
|
|
323
|
+
synchronized (this) {
|
|
324
|
+
paused = false;
|
|
325
|
+
}
|
|
326
|
+
|
|
320
327
|
attachLifecycleObserver();
|
|
321
328
|
if (savedMapState != null) {
|
|
322
329
|
super.onCreate(savedMapState);
|
|
@@ -325,9 +332,12 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
325
332
|
prepareAttacherView();
|
|
326
333
|
getMapAsync((map)->{
|
|
327
334
|
onMapReady(map);
|
|
328
|
-
savedFeatures.
|
|
329
|
-
|
|
330
|
-
|
|
335
|
+
if (savedFeatures != null && !savedFeatures.isEmpty()) {
|
|
336
|
+
for (int i = 0; i < savedFeatures.size(); i++) {
|
|
337
|
+
addFeature(savedFeatures.get(i), i);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
savedFeatures = null;
|
|
331
341
|
});
|
|
332
342
|
}
|
|
333
343
|
}
|
|
@@ -335,14 +345,35 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
335
345
|
// Override onDetachedFromWindow to detach lifecycle observer
|
|
336
346
|
@Override
|
|
337
347
|
protected void onDetachedFromWindow() {
|
|
338
|
-
|
|
339
|
-
|
|
348
|
+
synchronized (this) {
|
|
349
|
+
// Save instance state if not already saved and map is ready
|
|
350
|
+
if (map != null && isMapReady) {
|
|
351
|
+
try {
|
|
352
|
+
if (savedMapState == null) {
|
|
353
|
+
savedMapState = new Bundle();
|
|
354
|
+
}
|
|
355
|
+
super.onSaveInstanceState(savedMapState);
|
|
356
|
+
} catch (Exception e) {
|
|
357
|
+
Log.e("MapView", "Error saving state in onDetachedFromWindow: " + e.getMessage());
|
|
358
|
+
// Continue with cleanup even if state saving fails
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Pause safely if not already paused
|
|
363
|
+
if (!paused) {
|
|
364
|
+
onPause();
|
|
365
|
+
}
|
|
340
366
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
367
|
+
|
|
368
|
+
// These operations don't need synchronization
|
|
369
|
+
try {
|
|
370
|
+
onStop();
|
|
371
|
+
} catch (Exception e) {
|
|
372
|
+
Log.e("MapView", "Error during stop in onDetachedFromWindow: " + e.getMessage());
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
savedFeatures = new ArrayList<>(features);
|
|
376
|
+
features.clear();
|
|
346
377
|
shouldRestorePadding = true;
|
|
347
378
|
removeView(attacherGroup);
|
|
348
379
|
attacherGroup = null;
|
|
@@ -374,7 +405,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
374
405
|
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
|
375
406
|
boolean addedPosition = false;
|
|
376
407
|
LatLngBounds mapBounds = map.getProjection().getVisibleRegion().latLngBounds;
|
|
377
|
-
for (MapFeature feature : features
|
|
408
|
+
for (MapFeature feature : features) {
|
|
378
409
|
if (feature instanceof MapMarker) {
|
|
379
410
|
Marker marker = (Marker) feature.getFeature();
|
|
380
411
|
if (!onlyVisible ||
|
|
@@ -1128,7 +1159,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1128
1159
|
if (child instanceof MapMarker) {
|
|
1129
1160
|
MapMarker annotation = (MapMarker) child;
|
|
1130
1161
|
annotation.addToMap(markerCollection);
|
|
1131
|
-
features.
|
|
1162
|
+
features.add(index, annotation);
|
|
1132
1163
|
|
|
1133
1164
|
// Allow visibility event to be triggered later
|
|
1134
1165
|
int visibility = annotation.getVisibility();
|
|
@@ -1155,47 +1186,47 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1155
1186
|
} else if (child instanceof MapPolyline) {
|
|
1156
1187
|
MapPolyline polylineView = (MapPolyline) child;
|
|
1157
1188
|
polylineView.addToMap(polylineCollection);
|
|
1158
|
-
features.
|
|
1189
|
+
features.add(index, polylineView);
|
|
1159
1190
|
Polyline polyline = (Polyline) polylineView.getFeature();
|
|
1160
1191
|
polylineMap.put(polyline, polylineView);
|
|
1161
1192
|
} else if (child instanceof MapGradientPolyline) {
|
|
1162
1193
|
MapGradientPolyline polylineView = (MapGradientPolyline) child;
|
|
1163
1194
|
polylineView.addToMap(map);
|
|
1164
|
-
features.
|
|
1195
|
+
features.add(index, polylineView);
|
|
1165
1196
|
TileOverlay tileOverlay = (TileOverlay) polylineView.getFeature();
|
|
1166
1197
|
gradientPolylineMap.put(tileOverlay, polylineView);
|
|
1167
1198
|
} else if (child instanceof MapPolygon) {
|
|
1168
1199
|
MapPolygon polygonView = (MapPolygon) child;
|
|
1169
1200
|
polygonView.addToMap(polygonCollection);
|
|
1170
|
-
features.
|
|
1201
|
+
features.add(index, polygonView);
|
|
1171
1202
|
Polygon polygon = (Polygon) polygonView.getFeature();
|
|
1172
1203
|
polygonMap.put(polygon, polygonView);
|
|
1173
1204
|
} else if (child instanceof MapCircle) {
|
|
1174
1205
|
MapCircle circleView = (MapCircle) child;
|
|
1175
1206
|
circleView.addToMap(circleCollection);
|
|
1176
|
-
features.
|
|
1207
|
+
features.add(index, circleView);
|
|
1177
1208
|
} else if (child instanceof MapUrlTile) {
|
|
1178
1209
|
MapUrlTile urlTileView = (MapUrlTile) child;
|
|
1179
1210
|
urlTileView.addToMap(map);
|
|
1180
|
-
features.
|
|
1211
|
+
features.add(index, urlTileView);
|
|
1181
1212
|
} else if (child instanceof MapWMSTile) {
|
|
1182
1213
|
MapWMSTile urlTileView = (MapWMSTile) child;
|
|
1183
1214
|
urlTileView.addToMap(map);
|
|
1184
|
-
features.
|
|
1215
|
+
features.add(index, urlTileView);
|
|
1185
1216
|
} else if (child instanceof MapLocalTile) {
|
|
1186
1217
|
MapLocalTile localTileView = (MapLocalTile) child;
|
|
1187
1218
|
localTileView.addToMap(map);
|
|
1188
|
-
features.
|
|
1219
|
+
features.add(index, localTileView);
|
|
1189
1220
|
} else if (child instanceof MapOverlay) {
|
|
1190
1221
|
MapOverlay overlayView = (MapOverlay) child;
|
|
1191
1222
|
overlayView.addToMap(groundOverlayCollection);
|
|
1192
|
-
features.
|
|
1223
|
+
features.add(index, overlayView);
|
|
1193
1224
|
GroundOverlay overlay = (GroundOverlay) overlayView.getFeature();
|
|
1194
1225
|
overlayMap.put(overlay, overlayView);
|
|
1195
1226
|
} else if (child instanceof MapHeatmap) {
|
|
1196
1227
|
MapHeatmap heatmapView = (MapHeatmap) child;
|
|
1197
1228
|
heatmapView.addToMap(map);
|
|
1198
|
-
features.
|
|
1229
|
+
features.add(index, heatmapView);
|
|
1199
1230
|
TileOverlay heatmap = (TileOverlay) heatmapView.getFeature();
|
|
1200
1231
|
heatmapMap.put(heatmap, heatmapView);
|
|
1201
1232
|
} else if (child instanceof ViewGroup) {
|
|
@@ -1340,8 +1371,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1340
1371
|
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
|
1341
1372
|
|
|
1342
1373
|
boolean addedPosition = false;
|
|
1343
|
-
if (
|
|
1344
|
-
for (MapFeature feature : features
|
|
1374
|
+
if (features.size() > 0) {
|
|
1375
|
+
for (MapFeature feature : features) {
|
|
1345
1376
|
if (feature instanceof MapMarker) {
|
|
1346
1377
|
Marker marker = (Marker) feature.getFeature();
|
|
1347
1378
|
builder.include(marker.getPosition());
|
|
@@ -1383,7 +1414,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1383
1414
|
|
|
1384
1415
|
List<String> markerIDList = Arrays.asList(markerIDs);
|
|
1385
1416
|
|
|
1386
|
-
for (MapFeature feature : features
|
|
1417
|
+
for (MapFeature feature : features) {
|
|
1387
1418
|
if (feature instanceof MapMarker) {
|
|
1388
1419
|
String identifier = ((MapMarker) feature).getIdentifier();
|
|
1389
1420
|
Marker marker = (Marker) feature.getFeature();
|
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.26.
|
|
10
|
+
"version": "1.26.16",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"lint": "eslint . --max-warnings 0",
|