react-native-maps 1.26.10 → 1.26.11

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.
@@ -152,6 +152,12 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
152
152
  view.setUpdated(true);
153
153
  }
154
154
 
155
+ @Override
156
+ public void onDropViewInstance(MapMarker view) {
157
+ super.onDropViewInstance(view);
158
+ view.doDestroy();
159
+ }
160
+
155
161
  @Override
156
162
  public void setCalloutOffset(MapMarker view, @Nullable ReadableMap value) {
157
163
 
@@ -60,6 +60,7 @@ import com.rnmaps.fabric.event.OnDragStartEvent;
60
60
  import com.rnmaps.fabric.event.OnPressEvent;
61
61
  import com.rnmaps.fabric.event.OnSelectEvent;
62
62
 
63
+ import java.lang.ref.SoftReference;
63
64
  import java.lang.reflect.Method;
64
65
  import java.util.Map;
65
66
 
@@ -107,6 +108,10 @@ public class MapMarker extends MapFeature {
107
108
  private String imageUri;
108
109
  private boolean loadingImage;
109
110
 
111
+ private SoftReference<MarkerManager.Collection> markerCollectionRef;
112
+
113
+
114
+
110
115
  private final DraweeHolder<?> logoHolder;
111
116
  private ImageManager.OnImageLoadedListener imageLoadedListener;
112
117
  private DataSource<CloseableReference<CloseableImage>> dataSource;
@@ -209,6 +214,16 @@ public class MapMarker extends MapFeature {
209
214
  update(false);
210
215
  }
211
216
 
217
+ public void doDestroy() {
218
+ MarkerManager.Collection collection = markerCollectionRef != null
219
+ ? markerCollectionRef.get()
220
+ : null;
221
+
222
+ if (collection != null) {
223
+ this.removeFromMap(collection);
224
+ }
225
+ markerCollectionRef = null;
226
+ }
212
227
  public String getIdentifier() {
213
228
  return this.identifier;
214
229
  }
@@ -547,6 +562,7 @@ public class MapMarker extends MapFeature {
547
562
  public void addToMap(Object collection) {
548
563
  MarkerManager.Collection markerCollection = (MarkerManager.Collection) collection;
549
564
  marker = markerCollection.addMarker(getMarkerOptions());
565
+ this.markerCollectionRef = new SoftReference<>(markerCollection);
550
566
  updateTracksViewChanges();
551
567
  }
552
568
 
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.10",
8
+ "version": "1.26.11",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",