@rnmapbox/maps 10.1.5 → 10.1.7

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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +11 -0
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +1 -1
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +1 -1
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSource.kt +17 -7
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt +1 -1
  7. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableMap.kt +14 -0
  8. package/android/src/test/kotlin/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValueTest.kt +47 -0
  9. package/ios/RNMBX/RNMBXAtmosphere.swift +4 -4
  10. package/ios/RNMBX/RNMBXCamera.swift +7 -7
  11. package/ios/RNMBX/RNMBXCustomLocationProvider.swift +3 -3
  12. package/ios/RNMBX/RNMBXImages.swift +3 -3
  13. package/ios/RNMBX/RNMBXInteractiveElement.swift +3 -3
  14. package/ios/RNMBX/RNMBXLayer.swift +3 -3
  15. package/ios/RNMBX/RNMBXLight.swift +3 -3
  16. package/ios/RNMBX/RNMBXLogging.swift +6 -6
  17. package/ios/RNMBX/RNMBXMapView.swift +6 -2
  18. package/ios/RNMBX/RNMBXMapViewManager.m +2 -0
  19. package/ios/RNMBX/RNMBXMapViewManager.swift +2 -2
  20. package/ios/RNMBX/RNMBXMarkerView.swift +4 -6
  21. package/ios/RNMBX/RNMBXModels.swift +3 -3
  22. package/ios/RNMBX/RNMBXModule.swift +10 -5
  23. package/ios/RNMBX/RNMBXNativeUserLocation.swift +3 -3
  24. package/ios/RNMBX/RNMBXPointAnnotation.swift +2 -2
  25. package/ios/RNMBX/RNMBXSource.swift +2 -2
  26. package/ios/RNMBX/RNMBXStyleImport.swift +3 -3
  27. package/ios/RNMBX/RNMBXTerrain.swift +3 -3
  28. package/ios/RNMBX/RNMBXViewport.swift +3 -3
  29. package/lib/commonjs/RNMBXModule.js +8 -0
  30. package/lib/commonjs/RNMBXModule.js.map +1 -1
  31. package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js +6 -6
  32. package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js.map +1 -1
  33. package/lib/commonjs/components/MapView.js +5 -1
  34. package/lib/commonjs/components/MapView.js.map +1 -1
  35. package/lib/module/RNMBXModule.js +8 -0
  36. package/lib/module/RNMBXModule.js.map +1 -1
  37. package/lib/module/classes/AnimatedRouteCoordinatesArray.js +6 -6
  38. package/lib/module/classes/AnimatedRouteCoordinatesArray.js.map +1 -1
  39. package/lib/module/components/MapView.js +5 -1
  40. package/lib/module/components/MapView.js.map +1 -1
  41. package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
  42. package/lib/typescript/src/components/MapView.d.ts +5 -0
  43. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/rnmapbox-maps.podspec +13 -7
  46. package/setup-jest.js +1 -0
  47. package/src/RNMBXModule.ts +12 -0
  48. package/src/classes/AnimatedRouteCoordinatesArray.js +6 -3
  49. package/src/components/MapView.tsx +14 -5
package/README.md CHANGED
@@ -154,7 +154,7 @@ const styles = StyleSheet.create({
154
154
  - [Callout](/docs/Callout.md)
155
155
  - [Camera](docs/Camera.md)
156
156
  - [UserLocation](docs/UserLocation.md)
157
- - [LocaitonPuck](docs/LocationPuck.md)
157
+ - [LocationPuck](docs/LocationPuck.md)
158
158
  - [Images](docs/Images.md)
159
159
  - [Image](docs/Image.md)
160
160
  - [Models](docs/Models.md)
@@ -165,4 +165,15 @@ dependencies {
165
165
  implementation "com.squareup.okhttp3:okhttp:4.9.0"
166
166
  implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0"
167
167
  }
168
+
169
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
170
+ testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
171
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
172
+ testImplementation 'org.jetbrains.kotlin:kotlin-test'
173
+ testImplementation "org.mockito.kotlin:mockito-kotlin:5.2.1"
168
174
  }
175
+
176
+
177
+ tasks.withType(Test).configureEach {
178
+ useJUnitPlatform()
179
+ }
@@ -194,7 +194,7 @@ public class RNMBXMapViewFactory {
194
194
  }
195
195
 
196
196
  fun get(impl: String): Factory? {
197
- val (impl, options) = impl.split(":",limit=2);
197
+ val (impl, options) = impl.split(":",limit=2) + null;
198
198
  return factories.get(impl);
199
199
  }
200
200
  }
@@ -40,7 +40,7 @@ class RNMBXStyleValue(config: ReadableMap) {
40
40
  }
41
41
 
42
42
  fun getEnumName(): String {
43
- return mPayload!!.getString("value")!!.toUpperCase().replace("-", "_")
43
+ return mPayload!!.getString("value")!!.uppercase().replace("-", "_")
44
44
  }
45
45
 
46
46
  fun getDouble(key: String?): Double {
@@ -21,6 +21,9 @@ import com.rnmapbox.rnmbx.v11compat.feature.*
21
21
  // import com.rnmapbox.rnmbx.utils.DownloadMapImageTask;
22
22
  class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterDemSourceManager) :
23
23
  RNMBXTileSource<RasterDemSource?>(context) {
24
+
25
+ private var tileSize: Long? = null
26
+
24
27
  override fun onPress(event: OnPressEvent?) {
25
28
  mManager.handleEvent(FeatureClickEvent.makeVectorSourceEvent(this, event))
26
29
  }
@@ -35,15 +38,18 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD
35
38
  return mMap!!.getStyle()!!.getSource(DEFAULT_ID) as RasterDemSource
36
39
  }
37
40
  val configurationUrl = uRL
38
- return if (configurationUrl != null) {
39
- RasterDemSource(
40
- RasterDemSource.Builder(id)
41
- .url(configurationUrl)
42
- )
43
- } else RasterDemSource(
41
+
42
+ val builder = if (configurationUrl != null) {
43
+ RasterDemSource.Builder(id)
44
+ .url(configurationUrl)
45
+ } else {
44
46
  RasterDemSource.Builder(id)
45
47
  .tileSet(buildTileset())
46
- )
48
+ }
49
+
50
+ tileSize?.let { builder.tileSize(it) }
51
+
52
+ return RasterDemSource(builder)
47
53
  }
48
54
 
49
55
  fun querySourceFeatures(
@@ -81,4 +87,8 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD
81
87
  override fun hasNoDataSoRefersToExisting(): Boolean {
82
88
  return uRL == null && tileUrlTemplates.isEmpty()
83
89
  }
90
+
91
+ fun setTileSize(tileSize: Int) {
92
+ this.tileSize = tileSize.toLong()
93
+ }
84
94
  }
@@ -39,6 +39,6 @@ class RNMBXRasterDemSourceManager(private val mContext: ReactApplicationContext)
39
39
 
40
40
  @ReactProp(name = "tileSize")
41
41
  override fun setTileSize(view: RNMBXRasterDemSource, value: Dynamic) {
42
- Logger.e("RNMBXRasterDemSourceManager", "tileSize not implemented")
42
+ view.setTileSize(value.asInt())
43
43
  }
44
44
  }
@@ -1,5 +1,6 @@
1
1
  package com.rnmapbox.rnmbx.utils.extensions
2
2
 
3
+ import com.facebook.react.bridge.ReadableArray
3
4
  import com.facebook.react.bridge.ReadableMap
4
5
  import com.facebook.react.bridge.ReadableType
5
6
  import com.google.gson.JsonArray
@@ -83,6 +84,19 @@ fun ReadableMap.getAndLogIfNotString(key: String, tag: String = "RNMBXReadableMa
83
84
  }
84
85
  }
85
86
 
87
+ fun ReadableMap.getAndLogIfNotArray(key: String, tag: String = "RNMBXReadableMap"): ReadableArray? {
88
+ return if (hasKey(key)) {
89
+ if (getType(key) == ReadableType.Array) {
90
+ getArray(key)
91
+ } else {
92
+ Logger.e("RNMBXReadableMap", "$key is exected to be a Map but was: ${getType(key)}")
93
+ null
94
+ }
95
+ } else {
96
+ null
97
+ }
98
+ }
99
+
86
100
  fun ReadableMap.getAndLogIfNotMap(key: String, tag: String = "RNMBXReadableMap"): ReadableMap? {
87
101
  return if (hasKey(key)) {
88
102
  if (getType(key) == ReadableType.Map) {
@@ -0,0 +1,47 @@
1
+ import com.facebook.react.bridge.Dynamic
2
+ import com.facebook.react.bridge.ReadableMap
3
+ import com.rnmapbox.rnmbx.components.styles.RNMBXStyleValue
4
+ import org.junit.jupiter.api.BeforeEach
5
+ import org.junit.jupiter.api.Test
6
+ import org.junit.jupiter.api.Assertions.*
7
+ import org.mockito.Mockito
8
+ import java.util.Locale
9
+
10
+ class RNMBXStyleValueTest {
11
+
12
+ private lateinit var mockConfig: ReadableMap
13
+ private lateinit var mockPayload: ReadableMap
14
+ private lateinit var mockDynamic: Dynamic
15
+
16
+ @BeforeEach
17
+ fun setup() {
18
+ mockConfig = Mockito.mock(ReadableMap::class.java)
19
+ mockPayload = Mockito.mock(ReadableMap::class.java)
20
+ mockDynamic = Mockito.mock(Dynamic::class.java)
21
+
22
+ Mockito.`when`(mockConfig.getMap("stylevalue")).thenReturn(mockPayload)
23
+ Mockito.`when`(mockPayload.getDynamic("value")).thenReturn(mockDynamic)
24
+ }
25
+
26
+ @Test
27
+ fun `getEnumName returns correct enum name`() {
28
+ Mockito.`when`(mockPayload.getString("value")).thenReturn("test-value")
29
+
30
+ val styleValue = RNMBXStyleValue(mockConfig)
31
+
32
+ assertEquals("TEST_VALUE", styleValue.getEnumName())
33
+ }
34
+
35
+ @Test
36
+ fun `getEnumName handles Turkish locale correctly`() {
37
+ Mockito.`when`(mockPayload.getString("value")).thenReturn("miter")
38
+
39
+ val styleValue = RNMBXStyleValue(mockConfig)
40
+
41
+ Locale.setDefault(Locale("tr", "TR"))
42
+
43
+ assertEquals("MITER", styleValue.getEnumName())
44
+
45
+ Locale.setDefault(Locale.getDefault())
46
+ }
47
+ }
@@ -1,7 +1,7 @@
1
1
  import MapboxMaps
2
2
 
3
3
  #if RNMBX_11
4
- typealias Style = StyleManager
4
+ public typealias Style = StyleManager
5
5
  #endif
6
6
 
7
7
  @objc(RNMBXAtmosphere)
@@ -12,7 +12,7 @@ public class RNMBXAtmosphere : RNMBXSingletonLayer, RNMBXMapComponent, RNMBXSour
12
12
  return Atmosphere()
13
13
  }
14
14
 
15
- func addToMap(_ map: RNMBXMapView, style: Style) {
15
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
16
16
  self.map = map
17
17
  self.style = style
18
18
 
@@ -21,7 +21,7 @@ public class RNMBXAtmosphere : RNMBXSingletonLayer, RNMBXMapComponent, RNMBXSour
21
21
  addStylesAndUpdate()
22
22
  }
23
23
 
24
- func removeFromMap(_ map: RNMBXMapView, reason _: RemovalReason) -> Bool {
24
+ public func removeFromMap(_ map: RNMBXMapView, reason _: RemovalReason) -> Bool {
25
25
  self.map = nil
26
26
 
27
27
  guard let mapboxMap = map.mapboxMap else {
@@ -33,7 +33,7 @@ public class RNMBXAtmosphere : RNMBXSingletonLayer, RNMBXMapComponent, RNMBXSour
33
33
  return true
34
34
  }
35
35
 
36
- func waitForStyleLoad() -> Bool {
36
+ public func waitForStyleLoad() -> Bool {
37
37
  return true
38
38
  }
39
39
 
@@ -11,11 +11,11 @@ extension NSNumber {
11
11
  }
12
12
  #endif
13
13
 
14
- enum RemovalReason {
14
+ public enum RemovalReason {
15
15
  case ViewRemoval, StyleChange, OnDestroy, ComponentChange, Reorder
16
16
  }
17
17
 
18
- protocol RNMBXMapComponent: AnyObject {
18
+ public protocol RNMBXMapComponent: AnyObject {
19
19
  func addToMap(_ map: RNMBXMapView, style: Style)
20
20
  func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool
21
21
 
@@ -99,11 +99,11 @@ open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
99
99
  }
100
100
  }
101
101
 
102
- func waitForStyleLoad() -> Bool {
102
+ public func waitForStyleLoad() -> Bool {
103
103
  return false
104
104
  }
105
105
 
106
- func addToMap(_ map: RNMBXMapView, style: Style) {
106
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
107
107
  _mapCallbacks.forEach { callback in
108
108
  callback(map)
109
109
  }
@@ -111,7 +111,7 @@ open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
111
111
  _map = map
112
112
  }
113
113
 
114
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
114
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
115
115
  _mapCallbacks = []
116
116
  _map = nil
117
117
  return true
@@ -514,12 +514,12 @@ open class RNMBXCamera : RNMBXMapComponentBase {
514
514
  _updateCamera()
515
515
  }
516
516
 
517
- override func addToMap(_ map: RNMBXMapView, style: Style) {
517
+ public override func addToMap(_ map: RNMBXMapView, style: Style) {
518
518
  super.addToMap(map, style: style)
519
519
  map.reactCamera = self
520
520
  }
521
521
 
522
- override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
522
+ public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
523
523
  if (reason == .StyleChange) {
524
524
  return false
525
525
  }
@@ -43,7 +43,7 @@ public class RNMBXCustomLocationProvider: UIView, RNMBXMapComponent {
43
43
  var defaultLocationProvider: LocationProvider?
44
44
  #endif
45
45
 
46
- func addToMap(_ map: RNMBXMapView, style: Style) {
46
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
47
47
  self.map = map
48
48
  if let mapView = map.mapView {
49
49
  installCustomeLocationProviderIfNeeded(mapView: mapView)
@@ -58,7 +58,7 @@ public class RNMBXCustomLocationProvider: UIView, RNMBXMapComponent {
58
58
  updateHeading(heading: heading.doubleValue)
59
59
  }
60
60
 
61
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
61
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
62
62
  if let mapView = map.mapView {
63
63
  removeCustomLocationProvider(mapView: mapView)
64
64
  }
@@ -66,7 +66,7 @@ public class RNMBXCustomLocationProvider: UIView, RNMBXMapComponent {
66
66
  return true
67
67
  }
68
68
 
69
- func waitForStyleLoad() -> Bool {
69
+ public func waitForStyleLoad() -> Bool {
70
70
  false
71
71
  }
72
72
  }
@@ -75,11 +75,11 @@ open class RNMBXImages : UIView, RNMBXMapComponent {
75
75
 
76
76
  // MARK: - RNMBXMapComponent
77
77
 
78
- func waitForStyleLoad() -> Bool {
78
+ public func waitForStyleLoad() -> Bool {
79
79
  return false
80
80
  }
81
81
 
82
- func addToMap(_ map: RNMBXMapView, style: Style) {
82
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
83
83
  self.style = style
84
84
  imageManager = map.imageManager
85
85
  map.images.append(self)
@@ -89,7 +89,7 @@ open class RNMBXImages : UIView, RNMBXMapComponent {
89
89
  self.addImageViews(style: style, imageViews: imageViews)
90
90
  }
91
91
 
92
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
92
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
93
93
  self.style = nil
94
94
  imageManager = nil
95
95
  // v10todo
@@ -46,19 +46,19 @@ public class RNMBXInteractiveElement : UIView, RNMBXMapComponent {
46
46
  }
47
47
 
48
48
  // MARK: - RNMBXMapComponent
49
- func addToMap(_ map: RNMBXMapView, style: Style) {
49
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
50
50
  if (self.id == nil) {
51
51
  Logger.log(level: .error, message: "id is required on \(self) but not specified")
52
52
  }
53
53
  self.map = map
54
54
  }
55
55
 
56
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
56
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
57
57
  self.map = nil
58
58
  return true
59
59
  }
60
60
 
61
- func waitForStyleLoad() -> Bool {
61
+ public func waitForStyleLoad() -> Bool {
62
62
  return true
63
63
  }
64
64
  }
@@ -117,7 +117,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
117
117
  var existingLayer = false
118
118
 
119
119
  // MARK: - RNMBXMapComponent
120
- func waitForStyleLoad() -> Bool {
120
+ public func waitForStyleLoad() -> Bool {
121
121
  return true
122
122
  }
123
123
 
@@ -220,7 +220,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
220
220
 
221
221
  }
222
222
 
223
- func addToMap(_ map: RNMBXMapView, style: Style) {
223
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
224
224
  self.map = map
225
225
  self.style = style
226
226
  guard let id = id else {
@@ -321,7 +321,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
321
321
  }
322
322
  }
323
323
 
324
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
324
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
325
325
  removeFromMap(map.mapboxMap.style)
326
326
  return true
327
327
  }
@@ -51,18 +51,18 @@ public class RNMBXLight: UIView, RNMBXMapComponent {
51
51
 
52
52
  // MARK: - RNMBXMapComponent
53
53
 
54
- func waitForStyleLoad() -> Bool {
54
+ public func waitForStyleLoad() -> Bool {
55
55
  return true
56
56
  }
57
57
 
58
- func addToMap(_ map: RNMBXMapView, style: Style) {
58
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
59
59
  self.map = map.mapboxMap
60
60
  if (reactStyle != nil) {
61
61
  addStyles()
62
62
  }
63
63
  }
64
64
 
65
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
65
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
66
66
  self.map = nil
67
67
  return true
68
68
  }
@@ -1,19 +1,19 @@
1
1
  import Foundation
2
2
  import MapboxMaps
3
3
 
4
- enum RNMBXError: Error, LocalizedError {
4
+ public enum RNMBXError: Error, LocalizedError {
5
5
  case parseError(String)
6
6
  case failed(String)
7
7
  case paramError(String)
8
8
 
9
- var errorDescription: String? {
9
+ public var errorDescription: String? {
10
10
  return String(describing: self)
11
11
  }
12
12
  }
13
13
 
14
- class Logger {
15
- enum LogLevel : String, Comparable {
16
- static func < (lhs: Logger.LogLevel, rhs: Logger.LogLevel) -> Bool {
14
+ public class Logger {
15
+ public enum LogLevel : String, Comparable {
16
+ public static func < (lhs: Logger.LogLevel, rhs: Logger.LogLevel) -> Bool {
17
17
  return lhs.intValue < rhs.intValue
18
18
  }
19
19
 
@@ -56,7 +56,7 @@ class Logger {
56
56
  }
57
57
  }
58
58
 
59
- static func log(level: LogLevel, message: String) {
59
+ public static func log(level: LogLevel, message: String) {
60
60
  sharedInstance.log(level: level, message: message)
61
61
  }
62
62
 
@@ -2,7 +2,7 @@
2
2
  import Turf
3
3
  import MapKit
4
4
 
5
- public typealias RNMBXMapViewFactoryFunc = (String, UIView) -> MapView?;
5
+ public typealias RNMBXMapViewFactoryFunc = (String, UIView) -> (MapView?)
6
6
 
7
7
  /**
8
8
  * Experimental MapView factory for advanced usecases
@@ -191,6 +191,7 @@ open class RNMBXMapView: UIView {
191
191
 
192
192
  _mapView.gestures.delegate = self
193
193
  setupEvents()
194
+ afterMapViewAdded()
194
195
  }
195
196
 
196
197
  func createAndAddMapViewImpl(_ impl: String, _ view: RNMBXMapView) -> MapView? {
@@ -202,7 +203,7 @@ open class RNMBXMapView: UIView {
202
203
  }
203
204
  }
204
205
 
205
- var mapView : MapView! {
206
+ public var mapView : MapView! {
206
207
  get { return _mapView }
207
208
  }
208
209
  var mapboxMap: MapboxMap! {
@@ -841,6 +842,9 @@ open class RNMBXMapView: UIView {
841
842
  }
842
843
  }
843
844
  }
845
+
846
+ // MARK: - hooks for subclasses
847
+ open func afterMapViewAdded() {}
844
848
  }
845
849
 
846
850
  // MARK: - event handlers
@@ -37,4 +37,6 @@ RCT_REMAP_VIEW_PROPERTY(onPress, reactOnPress, RCTBubblingEventBlock)
37
37
  RCT_REMAP_VIEW_PROPERTY(onLongPress, reactOnLongPress, RCTBubblingEventBlock)
38
38
  RCT_REMAP_VIEW_PROPERTY(onMapChange, reactOnMapChange, RCTBubblingEventBlock)
39
39
 
40
+ RCT_EXPORT_VIEW_PROPERTY(mapViewImpl, NSString)
41
+
40
42
  @end
@@ -7,7 +7,7 @@ extension QueriedSourceFeature {
7
7
  #endif
8
8
 
9
9
  @objc(RNMBXMapViewManager)
10
- public class RNMBXMapViewManager: RCTViewManager {
10
+ open class RNMBXMapViewManager: RCTViewManager {
11
11
  @objc
12
12
  override public static func requiresMainQueueSetup() -> Bool {
13
13
  return true
@@ -17,7 +17,7 @@ public class RNMBXMapViewManager: RCTViewManager {
17
17
  return UIScreen.main.bounds
18
18
  }
19
19
 
20
- override public func view() -> UIView! {
20
+ override open func view() -> UIView! {
21
21
  let result = RNMBXMapView(frame: self.defaultFrame(), eventDispatcher: self.bridge.eventDispatcher())
22
22
  return result
23
23
  }
@@ -96,12 +96,12 @@ public class RNMBXMarkerView: UIView, RNMBXMapComponent {
96
96
 
97
97
  // MARK: - RNMBXMapComponent methods
98
98
 
99
- func addToMap(_ map: RNMBXMapView, style: Style) {
99
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
100
100
  self.map = map
101
101
  add()
102
102
  }
103
103
 
104
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
104
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
105
105
  remove()
106
106
  return true
107
107
  }
@@ -149,10 +149,8 @@ public class RNMBXMarkerView: UIView, RNMBXMapComponent {
149
149
  @objc public func updateAnnotationViewSize(_ next: CGRect, _ prev: CGRect) {
150
150
  annotationView.updateSize(next.size, oldOffset:calcOffset(size: prev.size), newOffset: calcOffset(size: next.size))
151
151
  }
152
-
153
-
154
-
155
- func waitForStyleLoad() -> Bool {
152
+
153
+ public func waitForStyleLoad() -> Bool {
156
154
  true
157
155
  }
158
156
 
@@ -31,7 +31,7 @@ open class RNMBXModels : UIView, RNMBXMapComponent {
31
31
 
32
32
  }
33
33
 
34
- func addToMap(_ map: RNMBXMapView, style: Style) {
34
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
35
35
  modelIdToUrl.forEach { (id, uri) in
36
36
  logged("Models.addStyleModel") {
37
37
  if let link = URL(string: uri), let scheme = link.scheme, let host = link.host,
@@ -48,7 +48,7 @@ open class RNMBXModels : UIView, RNMBXMapComponent {
48
48
  }
49
49
  }
50
50
 
51
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
51
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
52
52
  modelIdToUrl.forEach { (id, _) in
53
53
  #if RNMBX_11
54
54
  try? map._mapView?.mapboxMap.removeStyleModel(modelId: id)
@@ -57,7 +57,7 @@ open class RNMBXModels : UIView, RNMBXMapComponent {
57
57
  return true
58
58
  }
59
59
 
60
- func waitForStyleLoad() -> Bool {
60
+ public func waitForStyleLoad() -> Bool {
61
61
  true
62
62
  }
63
63
  }
@@ -8,18 +8,23 @@ import MapboxMobileEvents
8
8
  let DEFAULT_SOURCE_ID = "composite";
9
9
 
10
10
  @objc(RNMBXModule)
11
+ public
11
12
  class RNMBXModule : NSObject {
12
- #if RNMBX_11
13
- static var accessToken : String? {
13
+
14
+ public static var accessToken : String? {
14
15
  didSet {
16
+ #if RNMBX_11
15
17
  if let token = accessToken {
16
18
  MapboxOptions.accessToken = token
17
19
  }
20
+ #else
21
+ if let token = accessToken {
22
+ ResourceOptionsManager.default.resourceOptions.accessToken = token
23
+ }
24
+ #endif
18
25
  }
19
26
  }
20
- #else
21
- static var accessToken : String?
22
- #endif
27
+
23
28
 
24
29
  @objc
25
30
  func constantsToExport() -> [AnyHashable: Any]! {
@@ -214,14 +214,14 @@ public class RNMBXNativeUserLocation: UIView, RNMBXMapComponent {
214
214
  }
215
215
  }
216
216
 
217
- func addToMap(_ map: RNMBXMapView, style: Style) {
217
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
218
218
  self.map = map
219
219
 
220
220
  _fetchImages(map)
221
221
  _apply()
222
222
  }
223
223
 
224
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
224
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
225
225
  if let location = map.mapView.location {
226
226
  location.options.puckType = nil
227
227
  location.options.puckType = .none
@@ -234,7 +234,7 @@ public class RNMBXNativeUserLocation: UIView, RNMBXMapComponent {
234
234
  return true
235
235
  }
236
236
 
237
- func waitForStyleLoad() -> Bool {
237
+ public func waitForStyleLoad() -> Bool {
238
238
  return true
239
239
  }
240
240
  }
@@ -250,13 +250,13 @@ public class RNMBXPointAnnotation : RNMBXInteractiveElement {
250
250
 
251
251
  // MARK: - RNMBXMapComponent
252
252
 
253
- override func addToMap(_ map: RNMBXMapView, style: Style) {
253
+ public override func addToMap(_ map: RNMBXMapView, style: Style) {
254
254
  super.addToMap(map, style: style)
255
255
  self.map = map
256
256
  addIfPossible()
257
257
  }
258
258
 
259
- override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
259
+ public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
260
260
  removeIfAdded()
261
261
  self.map = nil
262
262
  return true
@@ -76,7 +76,7 @@ public class RNMBXSource : RNMBXInteractiveElement {
76
76
 
77
77
  // MARK: - RNMBXInteractiveElement
78
78
 
79
- override func addToMap(_ map: RNMBXMapView, style: Style) {
79
+ public override func addToMap(_ map: RNMBXMapView, style: Style) {
80
80
  self.map = map
81
81
 
82
82
  if style.sourceExists(withId: self.id) {
@@ -108,7 +108,7 @@ public class RNMBXSource : RNMBXInteractiveElement {
108
108
  }
109
109
  }
110
110
 
111
- override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
111
+ public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
112
112
  self.map = nil
113
113
 
114
114
  for layer in self.layers {
@@ -20,16 +20,16 @@ open class RNMBXStyleImport : UIView, RNMBXMapComponent {
20
20
  }
21
21
  }
22
22
 
23
- func waitForStyleLoad() -> Bool {
23
+ public func waitForStyleLoad() -> Bool {
24
24
  true
25
25
  }
26
26
 
27
- func addToMap(_ map: RNMBXMapView, style: Style) {
27
+ public func addToMap(_ map: RNMBXMapView, style: Style) {
28
28
  mapView = map.mapView
29
29
  apply(mapView: map.mapView)
30
30
  }
31
31
 
32
- func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
32
+ public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
33
33
  self.mapView = nil
34
34
  return true
35
35
  }