react-native-maps 1.26.8 → 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
  }
@@ -872,8 +872,9 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
872
872
 
873
873
  builder.tilt((float) camera.getDouble("pitch"));
874
874
  builder.bearing((float) camera.getDouble("heading"));
875
- builder.zoom((float) camera.getDouble("zoom"));
876
-
875
+ if (camera.hasKey("zoom")) {
876
+ builder.zoom((float) camera.getDouble("zoom"));
877
+ }
877
878
  return builder.build();
878
879
  }
879
880
 
@@ -1911,7 +1912,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1911
1912
  /**
1912
1913
  * Safely removes a view from its parent ViewGroup.
1913
1914
  * Prevents NullPointerException during component lifecycle operations.
1914
- *
1915
+ *
1915
1916
  * @param view The view to remove from its parent
1916
1917
  * @return true if the view was successfully removed, false otherwise
1917
1918
  */
@@ -1929,7 +1930,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1929
1930
  /**
1930
1931
  * Safely requests touch event handling from parent ViewGroup.
1931
1932
  * Prevents NullPointerException during touch event dispatching.
1932
- *
1933
+ *
1933
1934
  * @param disallowIntercept Whether to disallow parent touch interception
1934
1935
  * @return true if the request was successfully made, false otherwise
1935
1936
  */
@@ -1945,7 +1946,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
1945
1946
  /**
1946
1947
  * Safely removes a MapFeature from the attacherGroup.
1947
1948
  * Prevents NullPointerException during feature removal operations.
1948
- *
1949
+ *
1949
1950
  * @param feature The MapFeature to remove from attacherGroup
1950
1951
  * @return true if the feature was successfully removed, false otherwise
1951
1952
  */
@@ -525,6 +525,7 @@ if (!(newViewProps.name.latitude == 0 && \
525
525
  #define REMAP_MAPVIEW_CAMERA_PROP(name) \
526
526
  if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
527
527
  newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
528
+ newViewProps.name.altitude != oldViewProps.name.altitude || \
528
529
  newViewProps.name.heading != oldViewProps.name.heading || \
529
530
  newViewProps.name.pitch != oldViewProps.name.pitch) { \
530
531
  CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
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.8",
8
+ "version": "1.26.10",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",