@rnmapbox/maps 10.1.18 → 10.1.19

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.
@@ -46,6 +46,8 @@ class RNMBXPointAnnotation(private val mContext: Context, private val mManager:
46
46
  private var mCalloutSymbol: PointAnnotation? = null
47
47
  private var mCalloutBitmap: Bitmap? = null
48
48
  private var mCalloutBitmapId: String? = null
49
+
50
+ private val childViews = mutableListOf<View>();
49
51
  override fun addView(childView: View, childPosition: Int) {
50
52
  if (childView is RNMBXCallout) {
51
53
  calloutView = childView
@@ -55,6 +57,20 @@ class RNMBXPointAnnotation(private val mContext: Context, private val mManager:
55
57
  childView.addOnLayoutChangeListener(this)
56
58
 
57
59
  mMapView?.offscreenAnnotationViewContainer?.addView(childView)
60
+ childViews.add(childPosition, childView)
61
+ }
62
+
63
+ override fun getChildAt(childPosition: Int): View {
64
+ return childViews.get(childPosition)
65
+ }
66
+
67
+ override fun getChildCount(): Int {
68
+ return childViews.size
69
+ }
70
+
71
+ override fun removeViewAt(index: Int) {
72
+ val view = childViews.removeAt(index)
73
+ removeView(view)
58
74
  }
59
75
 
60
76
  override fun removeView(childView: View) {
@@ -42,7 +42,6 @@ class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationConte
42
42
  )
43
43
  }
44
44
 
45
- // TODO: check why it does not work correctly
46
45
  override fun createViewInstance(reactContext: ThemedReactContext): RNMBXPointAnnotation {
47
46
  return RNMBXPointAnnotation(reactContext!!, this)
48
47
  }
@@ -459,6 +459,15 @@ open class RNMBXCamera : RNMBXMapComponentBase {
459
459
  pitch: pitch ?? map.mapboxMap.cameraState.pitch
460
460
  )
461
461
  }
462
+ } else {
463
+ camera = CameraOptions(
464
+ center: nil,
465
+ padding: padding,
466
+ anchor: nil,
467
+ zoom: zoom,
468
+ bearing: heading,
469
+ pitch: pitch
470
+ )
462
471
  }
463
472
 
464
473
  guard let camera = camera else {
@@ -1,5 +1,7 @@
1
1
  import MapboxMaps
2
2
 
3
+ let TAG = "RNMBXCustomLocationProvider"
4
+
3
5
  @objc
4
6
  public class RNMBXCustomLocationProvider: UIView, RNMBXMapComponent {
5
7
  var map: RNMBXMapView? = nil
@@ -118,16 +120,21 @@ extension RNMBXCustomLocationProvider {
118
120
  let customLocationProvider = CustomLocationProvider()
119
121
  self.customLocationProvider = customLocationProvider
120
122
  if let locationModule = RNMBXLocationModule.shared {
121
- locationModule.override(for: mapView.location)
122
123
  locationModule.locationProvider = customLocationProvider
123
- // mapView.location.overrideLocationProvider(with: customLocationProvider!)
124
+ locationModule.override(for: mapView.location)
125
+ } else {
126
+ Logger.error(TAG, "RNMBXLocationModule.shared is nil")
127
+ mapView.location.overrideLocationProvider(with: customLocationProvider)
124
128
  }
125
129
 
126
130
  }
127
131
  }
128
132
 
129
133
  func removeCustomLocationProvider(mapView: MapView) {
130
- if let provider = defaultLocationProvider {
134
+ if let locationModule = RNMBXLocationModule.shared {
135
+ locationModule.resetLocationProvider()
136
+ locationModule.override(for: mapView.location)
137
+ } else if let provider = defaultLocationProvider {
131
138
  mapView.location.overrideLocationProvider(with: provider)
132
139
  }
133
140
  customLocationProvider = nil
@@ -460,6 +460,7 @@ class RNMBXLocationModule: RCTEventEmitter, LocationProviderRNMBXDelegate {
460
460
  var hasListener = false
461
461
 
462
462
  var locationProvider : LocationProvider
463
+ var defaultLocationProvider : LocationProvider? = nil
463
464
 
464
465
  var locationEventThrottle : (
465
466
  waitBetweenEvents: Double?,
@@ -471,6 +472,7 @@ class RNMBXLocationModule: RCTEventEmitter, LocationProviderRNMBXDelegate {
471
472
 
472
473
  override init() {
473
474
  locationProvider = LocationProviderRNMBX()
475
+ defaultLocationProvider = locationProvider
474
476
  super.init()
475
477
  if let locationProvider = locationProvider as? LocationProviderRNMBX {
476
478
  locationProvider.delegate = self
@@ -568,6 +570,12 @@ class RNMBXLocationModule: RCTEventEmitter, LocationProviderRNMBXDelegate {
568
570
  }
569
571
  }
570
572
 
573
+ func resetLocationProvider() {
574
+ if let defaultLocationProvider = defaultLocationProvider {
575
+ self.locationProvider = defaultLocationProvider
576
+ }
577
+ }
578
+
571
579
  // MARK: - location event throttle
572
580
  @objc
573
581
  func setLocationEventThrottle(_ throttleValue:NSNumber) {
@@ -78,6 +78,10 @@ public class Logger {
78
78
  }
79
79
  }
80
80
 
81
+ public static func error(_ tag: String, _ message: String) {
82
+ log(level: .error, tag: tag, message: message)
83
+ }
84
+
81
85
  public static func error(_ message: String) {
82
86
  log(level: .error, message: message)
83
87
  }
@@ -22,8 +22,7 @@ open class RNMBXModels : UIView, RNMBXMapComponent {
22
22
  self.modelIdToUrl = newModels
23
23
  }
24
24
  get {
25
- Logger.error("RNMBXModels.models.getter not implemented")
26
- return NSDictionary()
25
+ return modelIdToUrl as NSDictionary
27
26
  }
28
27
  }
29
28
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.1.18",
4
+ "version": "10.1.19",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },