react-native-maps 1.26.9 → 1.26.10

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.
@@ -17,11 +17,13 @@ import android.animation.TypeEvaluator;
17
17
  import android.os.Handler;
18
18
  import android.os.Looper;
19
19
 
20
+ import androidx.annotation.NonNull;
20
21
  import androidx.annotation.Nullable;
21
22
 
22
23
  import com.facebook.common.references.CloseableReference;
23
24
  import com.facebook.datasource.DataSource;
24
25
  import com.facebook.drawee.backends.pipeline.Fresco;
26
+ import com.facebook.drawee.controller.AbstractDraweeController;
25
27
  import com.facebook.drawee.controller.BaseControllerListener;
26
28
  import com.facebook.drawee.controller.ControllerListener;
27
29
  import com.facebook.drawee.drawable.ScalingUtils;
@@ -29,6 +31,8 @@ import com.facebook.drawee.generic.GenericDraweeHierarchy;
29
31
  import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
30
32
  import com.facebook.drawee.interfaces.DraweeController;
31
33
  import com.facebook.drawee.view.DraweeHolder;
34
+ import com.facebook.drawee.view.DraweeView;
35
+ import com.facebook.fresco.ui.common.ControllerListener2;
32
36
  import com.facebook.imagepipeline.core.ImagePipeline;
33
37
  import com.facebook.imagepipeline.image.CloseableImage;
34
38
  import com.facebook.imagepipeline.image.CloseableStaticBitmap;
@@ -56,6 +60,7 @@ import com.rnmaps.fabric.event.OnDragStartEvent;
56
60
  import com.rnmaps.fabric.event.OnPressEvent;
57
61
  import com.rnmaps.fabric.event.OnSelectEvent;
58
62
 
63
+ import java.lang.reflect.Method;
59
64
  import java.util.Map;
60
65
 
61
66
  public class MapMarker extends MapFeature {
@@ -324,7 +329,7 @@ public class MapMarker extends MapFeature {
324
329
  }
325
330
 
326
331
  updateMarkerIcon();
327
- if (updated > 0){
332
+ if (updated > 0) {
328
333
  updated--;
329
334
  }
330
335
  return true;
@@ -449,9 +454,67 @@ public class MapMarker extends MapFeature {
449
454
  if (!(child instanceof MapCallout)) {
450
455
  hasCustomMarkerView = true;
451
456
  updateTracksViewChanges();
457
+ hackToHandleDraweeLifecycle(child);
452
458
  }
453
459
  update(true);
454
460
  }
461
+ private void hackToHandleDraweeLifecycle(View child){
462
+ if (child instanceof DraweeView<?>) {
463
+ try {
464
+ DraweeView draweeView = (DraweeView) child;
465
+
466
+ Method onAttachMethod = DraweeView.class.getDeclaredMethod("onAttachedToWindow");
467
+ onAttachMethod.setAccessible(true);
468
+ onAttachMethod.invoke(child);
469
+
470
+ Handler mainHandler = new Handler(Looper.getMainLooper());
471
+
472
+ if (draweeView.getController() instanceof AbstractDraweeController<?,?>){
473
+ AbstractDraweeController abstractController = (AbstractDraweeController) draweeView.getController();
474
+
475
+ abstractController.addControllerListener2(new ControllerListener2() {
476
+ @Override
477
+ public void onSubmit(@NonNull String s, @Nullable Object o, @Nullable Extras extras) {
478
+
479
+ }
480
+
481
+ @Override
482
+ public void onFinalImageSet(@NonNull String s, @Nullable Object o, @Nullable Extras extras) {
483
+ mainHandler.postDelayed(() -> update(true), ((GenericDraweeHierarchy) draweeView.getHierarchy()).getFadeDuration());
484
+ }
485
+
486
+ @Override
487
+ public void onIntermediateImageSet(@NonNull String s, @Nullable Object o) {
488
+ mainHandler.post(() -> update(true));
489
+ }
490
+
491
+ @Override
492
+ public void onIntermediateImageFailed(@NonNull String s) {
493
+
494
+ }
495
+
496
+ @Override
497
+ public void onFailure(@NonNull String s, @Nullable Throwable throwable, @Nullable Extras extras) {
498
+
499
+ }
500
+
501
+ @Override
502
+ public void onRelease(@NonNull String s, @Nullable Extras extras) {
503
+
504
+ }
505
+
506
+ @Override
507
+ public void onEmptyEvent(@Nullable Object o) {
508
+
509
+ }
510
+ });
511
+ }
512
+
513
+ } catch (Exception e) {
514
+ e.printStackTrace();
515
+ }
516
+ }
517
+ }
455
518
 
456
519
  @Override
457
520
  public void requestLayout() {
@@ -556,13 +619,13 @@ public class MapMarker extends MapFeature {
556
619
  } else {
557
620
  marker.setInfoWindowAnchor(0.5f, 0);
558
621
  }
559
- updated +=1;
622
+ updated += 1;
560
623
  }
561
624
 
562
625
  public void update(int width, int height) {
563
626
  this.width = width;
564
627
  this.height = height;
565
- updated +=1;
628
+ updated += 1;
566
629
  updateTracksViewChanges();
567
630
  clearDrawableCache();
568
631
  update(true);
@@ -740,10 +803,10 @@ public class MapMarker extends MapFeature {
740
803
  );
741
804
  }
742
805
 
743
- @Override
744
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
745
- super.onLayout(changed, l, t, r, b);
746
- this.height = b-t;
747
- this.width = r-l;
748
- }
806
+ @Override
807
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
808
+ super.onLayout(changed, l, t, r, b);
809
+ this.height = b - t;
810
+ this.width = r - l;
811
+ }
749
812
  }
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.9",
8
+ "version": "1.26.10",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",