@mapsindoors/react-native-maps-indoors-mapbox 2.9.1 → 2.11.0

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 (37) hide show
  1. package/Package.swift +87 -0
  2. package/README.md +82 -21
  3. package/android/build.gradle +2 -14
  4. package/android/src/main/java/com/mapsindoorsrn/MapboxMapView.java +4 -0
  5. package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsPackage.java +10 -1
  6. package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsViewManager.java +28 -2
  7. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +10 -2
  8. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +1 -0
  9. package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +24 -0
  10. package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +335 -99
  11. package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +17 -1
  12. package/android/src/main/java/com/mapsindoorsrn/core/RouteStore.java +59 -0
  13. package/app.plugin.js +8 -86
  14. package/ios/core/DirectionsRendererBridge.m +1 -0
  15. package/ios/core/DirectionsRendererModule.swift +6 -3
  16. package/ios/core/DirectionsServiceModule.swift +7 -1
  17. package/ios/core/MPDisplayRuleBridge.m +9 -0
  18. package/ios/core/MPDisplayRuleModule.swift +18 -0
  19. package/ios/core/MapControlModule.swift +8 -4
  20. package/ios/core/MapsIndoorsBridge.m +1 -0
  21. package/ios/core/MapsIndoorsModule.swift +45 -2
  22. package/ios/core/ReactPositionProvider.swift +6 -7
  23. package/ios/core/Sources/RouteStore/RouteStore.swift +62 -0
  24. package/ios/spm-bridges/include/MapsIndoorsBridges.h +1 -0
  25. package/package.json +11 -3
  26. package/react-native-maps-indoors-mapbox.podspec +8 -11
  27. package/specs/NativeDirectionsRendererModule.ts +1 -1
  28. package/specs/NativeMPDisplayRuleModule.ts +2 -0
  29. package/specs/NativeMapsIndoorsModule.ts +1 -1
  30. package/src/core/MPBuilding.ts +2 -1
  31. package/src/core/MPDirectionsRenderer.ts +7 -1
  32. package/src/core/MPDirectionsService.ts +4 -1
  33. package/src/core/MPDisplayRule.ts +25 -0
  34. package/src/core/MPFloor.ts +25 -0
  35. package/src/core/MPSolutionConfig.ts +42 -0
  36. package/src/core/MapsIndoors.ts +39 -7
  37. package/src/core/RouteHandles.ts +76 -0
package/Package.swift ADDED
@@ -0,0 +1,87 @@
1
+ // swift-tools-version: 6.0
2
+ import Foundation
3
+ import PackageDescription
4
+
5
+ // Swift Package Manager support for React Native's SwiftPM autolinking (react-native >= 0.88,
6
+ // `npx react-native spm`). CocoaPods apps use the podspec instead; the two ship side by side and
7
+ // must name the same iOS SDK version (checked by __tests__/nativeSdkVersions.test.ts).
8
+ let iosSdkVersion = "4.24.1"
9
+
10
+ let packageDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
11
+
12
+ // SwiftPM cannot mix Swift and Objective-C in one target, so the RCT_EXTERN_MODULE declaration
13
+ // files (which never import Swift) are a target of their own. They are found by extension, so a new
14
+ // bridge file needs no change here.
15
+ let bridgeFiles: [String] = {
16
+ let ios = packageDirectory.appendingPathComponent("ios").path
17
+ guard let walker = FileManager.default.enumerator(atPath: ios) else { return [] }
18
+ var found: [String] = []
19
+ for case let path as String in walker {
20
+ let name = (path as NSString).lastPathComponent
21
+ if name == ".build" || name == "Tests" { walker.skipDescendants(); continue }
22
+ if name.hasSuffix(".m") { found.append(path) }
23
+ }
24
+ return found.sorted()
25
+ }()
26
+
27
+ // The Swift sources rely on the CocoaPods bridging header for React's Objective-C types
28
+ // (RCTPromiseResolveBlock and friends). unsafeFlags is allowed here because autolinking consumes
29
+ // this package by local path.
30
+ let bridgingHeader = packageDirectory.appendingPathComponent("ios/react-native-maps-indoors-Bridging-Header.h").path
31
+
32
+ // Paths in the repo that are not in the published package (the npm `files` list drops them).
33
+ let swiftExcludes = [
34
+ "react-native-maps-indoors-Bridging-Header.h",
35
+ "MapsIndoors.xcodeproj",
36
+ "MapsIndoors.xcworkspace",
37
+ "spm-bridges",
38
+ "core/Package.swift",
39
+ "core/README.md",
40
+ "core/Tests",
41
+ "core/.build",
42
+ ].filter { FileManager.default.fileExists(atPath: packageDirectory.appendingPathComponent("ios/\($0)").path) }
43
+
44
+ let reactHeaders: [Target.Dependency] = [
45
+ .product(name: "ReactHeaders", package: "ReactNative"),
46
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
47
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
48
+ ]
49
+
50
+ let package = Package(
51
+ name: "ReactNativeMapsIndoorsMapbox",
52
+ platforms: [.iOS(.v16)],
53
+ products: [
54
+ .library(
55
+ name: "ReactNativeMapsIndoorsMapbox",
56
+ targets: ["ReactNativeMapsIndoorsMapbox", "ReactNativeMapsIndoorsMapboxBridges"]
57
+ ),
58
+ ],
59
+ dependencies: [
60
+ // Resolved by the autolinker relative to build/generated/autolinking/libs/<name> in the app.
61
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
62
+ .package(url: "https://github.com/MapsPeople/mapsindoors-mapbox-ios.git", exact: Version(stringLiteral: iosSdkVersion)),
63
+ .package(url: "https://github.com/MapsPeople/mapsindoors-codable-ios.git", exact: Version(stringLiteral: iosSdkVersion)),
64
+ ],
65
+ targets: [
66
+ .target(
67
+ name: "ReactNativeMapsIndoorsMapboxBridges",
68
+ dependencies: reactHeaders,
69
+ path: "ios",
70
+ sources: bridgeFiles,
71
+ publicHeadersPath: "spm-bridges/include"
72
+ ),
73
+ .target(
74
+ name: "ReactNativeMapsIndoorsMapbox",
75
+ dependencies: reactHeaders + [
76
+ .product(name: "MapsIndoorsMapbox", package: "mapsindoors-mapbox-ios"),
77
+ .product(name: "MapsIndoorsCodable", package: "mapsindoors-codable-ios"),
78
+ ],
79
+ path: "ios",
80
+ exclude: bridgeFiles + swiftExcludes,
81
+ swiftSettings: [
82
+ .unsafeFlags(["-import-objc-header", bridgingHeader]),
83
+ ]
84
+ ),
85
+ ],
86
+ swiftLanguageModes: [.v5]
87
+ )
package/README.md CHANGED
@@ -2,11 +2,80 @@
2
2
 
3
3
  ## Documentation
4
4
 
5
- Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.9.1/index.html) to get an overview of what the MapsIndoors SDK offers.
5
+ Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.11.0/index.html) to get an overview of what the MapsIndoors SDK offers.
6
6
 
7
7
  ## Changelog
8
8
 
9
- ### [2.9.1] - 2026-10-15
9
+ ### [2.11.0] - 2026-11-10
10
+
11
+ #### Added
12
+
13
+ - `MPDisplayRule.getIconZoomFactor` and `setIconZoomFactor`: how much a location's icon grows across
14
+ the solution's icon zoom range. The factor must be finite and within `0 < factor <= 4`; any other
15
+ value is ignored with a console warning. The default is `1`. Mapbox only: icons do not scale with
16
+ Google Maps
17
+ - `MPSolutionConfig.iconScaleZoomFrom` and `iconScaleZoomTo`: the solution's icon zoom range, as the
18
+ solution stores it, or `undefined` when it is not set
19
+ - Swift Package Manager support for apps built with React Native 0.88's `npx react-native spm`
20
+ (experimental). The package ships a `Package.swift` next to the podspec; CocoaPods stays supported
21
+
22
+ #### Changed
23
+
24
+ - Updated the MapsIndoors iOS SDK to 4.24.1, the release that carries base-map caching before the
25
+ first map
26
+ - Updated the MapsIndoors Android SDK to 4.24.2
27
+
28
+ #### Fixed
29
+
30
+ - On iOS, `MapsIndoors.synchronizeBaseMapTiles` no longer rejects with error 9000 before
31
+ `MapControl.create` has run, so base-map tiles can be cached ahead of the first map, as on
32
+ Android. `MapsIndoors.isBaseMapCachingSupported` and `synchronizeBaseMapTiles` now agree on
33
+ Mapbox. Until `MapControl.create` has run, the MapsIndoors Mapbox style is cached
34
+ - `MapControl.selectBuilding` and `MapControl.goTo` now pass a building's floors to the native SDK,
35
+ which used to receive the building without any
36
+
37
+ ### [2.10.0] - 2026-11-02
38
+
39
+ #### Added
40
+
41
+ - MapsIndoors Insights now attributes sessions from this package to its own component -
42
+ `React Native/android SDK` or `React Native/iOS SDK`, with the package's published version -
43
+ instead of reporting them as the plain native SDK. The version travels on `MapsIndoors.load`,
44
+ which is when the native SDK starts the session and snapshots the component, so the first session
45
+ after a cold start is attributed too
46
+
47
+ #### Changed
48
+
49
+ - No Mapbox download token is needed any more (Mapbox SDK 11.8+ downloads are public). The Expo
50
+ plugin ignores `downloadToken`, warns when it is set, and no longer writes
51
+ `MAPBOX_DOWNLOADS_TOKEN` to `gradle.properties` or credentials to `~/.netrc`. The Mapbox Maven
52
+ repository is added without credentials
53
+ - `MapControl.getCurrentFloorIndex`, `getCurrentMapsIndoorsZoom`, `isFloorSelectorHidden` and
54
+ `isUserPositionShown` reject when there is no map control. iOS resolved `null`, which reads as a
55
+ real floor index, zoom or `false`; Android crashed
56
+
57
+ #### Fixed
58
+
59
+ - On iOS, the blue dot now shows for a JavaScript position provider whose results leave out
60
+ `floorIndex`. Every such update was rejected, silently
61
+ - On iOS, the blue dot now shows for a position provider set after calling `MapsIndoors.load` again
62
+ while the map stays mounted
63
+ - Expo builds without `downloadToken` no longer fail to download Mapbox. The plugin wrote
64
+ `undefined` as the token to `gradle.properties` and `~/.netrc`, which Mapbox rejects with 401.
65
+ If an earlier plugin version wrote one, remove the `machine api.mapbox.com` entry from `~/.netrc`
66
+ - Opening and closing a map no longer leaks memory on every visit. On iOS, setting a position
67
+ provider kept the map alive in a retain cycle. On Android, the map's `MapControl` was never
68
+ destroyed and a layout callback kept running for good, so each map stayed in memory; the
69
+ `MapControl` is now destroyed with its map view. Without one, Android `MapControl` calls now
70
+ reject, resolve `null` or do nothing, as on iOS, instead of crashing
71
+ - On Android, `MapControl.clearFilter`, `clearHighlight` and `showUserPosition` resolve when there is
72
+ no map control, instead of never settling
73
+ - MapsIndoors Insights `directions_started` and `directions_completed` events now carry the
74
+ route's origin and destination location and venue, as from native apps. Requires a route
75
+ `MPDirectionsService.getRoute` returned since the last `MapsIndoors.load`, among the ten most
76
+ recently used; a copy made through JSON qualifies, an edited route does not
77
+
78
+ ### [2.9.1] - 2026-10-16
10
79
 
11
80
  #### Changed
12
81
 
@@ -177,10 +246,16 @@ end
177
246
  ...
178
247
  ```
179
248
 
249
+ #### Swift Package Manager (experimental)
250
+
251
+ React Native 0.88 can build an iOS app without CocoaPods: run `npx react-native spm` in the app's
252
+ `ios` folder. This package ships a `Package.swift` for that mode; CocoaPods stays supported. It needs
253
+ iOS 16 and no extra setup. Verified on a bare React Native 0.88 app, not on Expo or with
254
+ `app.plugin.js`.
255
+
180
256
  #### Providing API key
181
257
 
182
- 1. Navigate to your application settings and add your Mapbox public access token to info with the key `MBXAccessToken`
183
- 2. Setup your secret access token for downloading the sdk. Read how to do this here: [Configure credentials](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials)
258
+ Navigate to your application settings and add your Mapbox public access token to info with the key `MBXAccessToken`
184
259
 
185
260
  ### Android
186
261
 
@@ -208,9 +283,8 @@ To get the underlying Mapbox to function, you need to perform the following step
208
283
  ​
209
284
  The plugin Gradle project has trouble resolving the MapsIndoors dependency, so to ensure that it is resolved correctly, do the following:
210
285
 
211
- 1. Navigate to the app `gradle.properties` and add the value MAPBOX_DOWNLOADS_TOKEN with your Mapbox download access token.
212
- 2. Navigate to the app's project level `build.gradle`.
213
- 3. add `maven { url 'https://maven.mapsindoors.com/' }` to `allprojects`/`repositories` as well as the Mapbox maven
286
+ 1. Navigate to the app's project level `build.gradle`.
287
+ 2. add `maven { url 'https://maven.mapsindoors.com/' }` to `allprojects`/`repositories` as well as the Mapbox maven
214
288
  ​
215
289
 
216
290
  ```groovy
@@ -219,19 +293,7 @@ allprojects {
219
293
  google()
220
294
  mavenCentral()
221
295
  maven { url 'https://maven.mapsindoors.com/' }
222
- maven {
223
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
224
- authentication {
225
- basic(BasicAuthentication)
226
- }
227
- credentials {
228
- // Do not change the username below.
229
- // This should always be `mapbox` (not your username).
230
- username = "mapbox"
231
- // Use the secret token you stored in gradle.properties as the password
232
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
233
- }
234
- }
296
+ maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' }
235
297
  }
236
298
  }
237
299
  ```
@@ -276,7 +338,6 @@ To enable it, you need to add the configuration in your expo configuration.
276
338
  "@mapsindoors/react-native-maps-indoors-mapbox/app.plugin.js", // plugin ref
277
339
  {
278
340
  "publicToken": "PUBLIC_TOKEN", // your map public token
279
- "downloadToken": "DOWNLOAD_TOKEN", // your download token
280
341
  "staticPods": true // OPTIONAL, add if your project uses static linkage for pods (ex: "useFrameworks": "static" with expo-build-properties)
281
342
  }
282
343
  ]
@@ -90,23 +90,11 @@ repositories {
90
90
 
91
91
  dependencies {
92
92
  repositories {
93
- maven {
94
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
95
- authentication {
96
- basic(BasicAuthentication)
97
- }
98
- credentials {
99
- // Do not change the username below.
100
- // This should always be `mapbox` (not your username).
101
- username = "mapbox"
102
- // Use the secret token you stored in gradle.properties as the password
103
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
104
- }
105
- }
93
+ maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' }
106
94
  }
107
95
 
108
96
  implementation 'com.mapbox.maps:android-ndk27:11.16.1'
109
- implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.23.0'
97
+ implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.24.2'
110
98
  implementation 'com.facebook.react:react-native:+' // From node_modules
111
99
  implementation 'androidx.core:core-ktx:1.3.2'
112
100
  implementation 'com.github.bumptech.glide:glide:4.16.0'
@@ -34,6 +34,10 @@ public class MapboxMapView implements RCMapView {
34
34
  mContext = context;
35
35
  }
36
36
 
37
+ MapView getMapView() {
38
+ return mMapView;
39
+ }
40
+
37
41
  @Override
38
42
  public void animateCamera(MPCameraUpdate cameraUpdate, Integer duration, OnResultReadyListener onFinished) {
39
43
  CameraOptions cameraOptions = toCameraOptions(cameraUpdate);
@@ -29,6 +29,8 @@ import java.util.Map;
29
29
  public class MapsIndoorsPackage extends TurboReactPackage implements OnResultReadyListener {
30
30
  private volatile MapControlModule mapControlModule;
31
31
  private MapsIndoorsViewManager viewManager;
32
+ // The view handed to MapControlModule. UI thread only.
33
+ @Nullable private MapboxMapView mapView;
32
34
  private ReactApplicationContext mContext;
33
35
 
34
36
  public MapsIndoorsPackage() {
@@ -102,13 +104,20 @@ public class MapsIndoorsPackage extends TurboReactPackage implements OnResultRea
102
104
  public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
103
105
  mContext = reactContext;
104
106
  viewManager = new MapsIndoorsViewManager(reactContext, this);
107
+ viewManager.setOnViewDroppedListener(view -> {
108
+ if (mapControlModule != null && mapView != null && mapView.getMapView() == view) {
109
+ mapControlModule.onViewDropped(mapView);
110
+ mapView = null;
111
+ }
112
+ });
105
113
  return Collections.singletonList(viewManager);
106
114
  }
107
115
 
108
116
  @Override
109
117
  public void onResultReady(@Nullable MIError miError) {
110
118
  if (mapControlModule != null && viewManager != null) {
111
- mapControlModule.setView(new MapboxMapView(viewManager.getView(), mContext));
119
+ mapView = new MapboxMapView(viewManager.getView(), mContext);
120
+ mapControlModule.setView(mapView);
112
121
  }
113
122
  }
114
123
  }
@@ -52,8 +52,17 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
52
52
  // holds the MapView, so a weak key would be kept reachable by its own value and never clear.
53
53
  private final Map<MapView, MapViewLifecycleOwner> lifecycleOwners = new HashMap<>();
54
54
 
55
+ // setupLayout's frame callback re-posts itself every frame, so the Choreographer would keep it, and
56
+ // the view it lays out, alive for good. Tracked per view so onDropViewInstance can stop it (SPEX-2885).
57
+ private final Map<View, Choreographer.FrameCallback> layoutCallbacks = new HashMap<>();
58
+
59
+ interface OnViewDroppedListener {
60
+ void onViewDropped(MapView view);
61
+ }
62
+
55
63
  ReactApplicationContext mReactContext;
56
64
  OnResultReadyListener mOnMapReadyCallback;
65
+ @Nullable OnViewDroppedListener mOnViewDroppedListener;
57
66
 
58
67
  public MapsIndoorsViewManager(ReactApplicationContext reactContext, OnResultReadyListener onMapReadyCallback) {
59
68
  mReactContext = reactContext;
@@ -82,6 +91,10 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
82
91
  });
83
92
  }
84
93
 
94
+ void setOnViewDroppedListener(@Nullable OnViewDroppedListener listener) {
95
+ mOnViewDroppedListener = listener;
96
+ }
97
+
85
98
  private void setHostResumedOnAll(boolean hostResumed) {
86
99
  for (MapViewLifecycleOwner owner : lifecycleOwners.values()) {
87
100
  owner.setHostResumed(hostResumed);
@@ -138,6 +151,14 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
138
151
  @Override
139
152
  public void onDropViewInstance(@NonNull MapView view) {
140
153
  super.onDropViewInstance(view);
154
+ Choreographer.FrameCallback layoutCallback = layoutCallbacks.remove(view);
155
+ if (layoutCallback != null) {
156
+ Choreographer.getInstance().removeFrameCallback(layoutCallback);
157
+ }
158
+ // Before the map is destroyed, so its MapControl can still tear down against it.
159
+ if (mOnViewDroppedListener != null) {
160
+ mOnViewDroppedListener.onViewDropped(view);
161
+ }
141
162
  MapViewLifecycleOwner lifecycleOwner = lifecycleOwners.remove(view);
142
163
  if (lifecycleOwner != null) {
143
164
  // Driving the lifecycle to DESTROYED lets the MapView's lifecycle observer tear it down on
@@ -287,14 +308,19 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
287
308
  }
288
309
 
289
310
  public void setupLayout(View view) {
290
- Choreographer.getInstance().postFrameCallback(new Choreographer.FrameCallback() {
311
+ Choreographer.FrameCallback layoutCallback = new Choreographer.FrameCallback() {
291
312
  @Override
292
313
  public void doFrame(long frameTimeNanos) {
293
314
  manuallyLayoutChildren(view);
294
315
  view.getViewTreeObserver().dispatchOnGlobalLayout();
295
316
  Choreographer.getInstance().postFrameCallback(this);
296
317
  }
297
- });
318
+ };
319
+ Choreographer.FrameCallback previous = layoutCallbacks.put(view, layoutCallback);
320
+ if (previous != null) {
321
+ Choreographer.getInstance().removeFrameCallback(previous);
322
+ }
323
+ Choreographer.getInstance().postFrameCallback(layoutCallback);
298
324
  }
299
325
 
300
326
  /**
@@ -66,6 +66,11 @@ public class DirectionsRendererModule extends ReactContextBaseJavaModule impleme
66
66
  public DirectionsRendererModule(@NonNull ReactApplicationContext reactContext, MapControlModule mapControl) {
67
67
  super(reactContext);
68
68
  mapControl.setOnMapControlReadyListener(this);
69
+ // The renderer holds the MapControl, so it goes with it.
70
+ mapControl.setOnMapControlDestroyedListener(() -> {
71
+ mMapControl = null;
72
+ mRenderer = null;
73
+ });
69
74
  mCtx = reactContext;
70
75
  }
71
76
 
@@ -288,10 +293,13 @@ public class DirectionsRendererModule extends ReactContextBaseJavaModule impleme
288
293
  }
289
294
 
290
295
  @ReactMethod
291
- public void setRoute(String routeString, String icons, int legIndex, final Promise promise) {
296
+ public void setRoute(String routeString, String icons, int legIndex, @Nullable String routeId, final Promise promise) {
292
297
  if (mRenderer != null) {
293
298
  Context ctx = mCtx.getApplicationContext();
294
- MPRoute route = gson.fromJson(routeString, MPRoute.class);
299
+ // The route getRoute kept, when JavaScript names one: only that instance carries the
300
+ // endpoints the directions Insights events report.
301
+ MPRoute kept = RouteStore.get(routeId);
302
+ MPRoute route = kept != null ? kept : gson.fromJson(routeString, MPRoute.class);
295
303
  if (icons != null) {
296
304
  new Handler().post(()-> {
297
305
  // Posted to the main looper, so this body is off React Native's stack: a throw
@@ -108,6 +108,7 @@ public class DirectionsServiceModule extends ReactContextBaseJavaModule {
108
108
  try {
109
109
  if (route != null) {
110
110
  map.putString("route", gson.toJson(route));
111
+ map.putString("routeId", RouteStore.keep(route));
111
112
  }
112
113
  if (error != null) {
113
114
  map.putString("error", gson.toJson(error));
@@ -920,6 +920,30 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
920
920
  }
921
921
  }
922
922
 
923
+ @ReactMethod
924
+ public void getIconZoomFactor(String displayRuleId, final Promise promise) {
925
+ MPDisplayRule displayRule = getRule(displayRuleId);
926
+ if (displayRule != null) {
927
+ // Rules without a parent (highlight, selection) can resolve no factor. The renderer then
928
+ // uses 1.0, which is also what iOS reports.
929
+ Double factor = displayRule.getIconZoomFactor();
930
+ promise.resolve(factor != null ? factor : 1.0);
931
+ } else {
932
+ reject(promise, displayRuleId);
933
+ }
934
+ }
935
+
936
+ @ReactMethod
937
+ public void setIconZoomFactor(String displayRuleId, Double factor, final Promise promise) {
938
+ MPDisplayRule displayRule = getRule(displayRuleId);
939
+ if (displayRule != null) {
940
+ displayRule.setIconZoomFactor(factor);
941
+ promise.resolve(null);
942
+ } else {
943
+ reject(promise, displayRuleId);
944
+ }
945
+ }
946
+
923
947
  @ReactMethod
924
948
  public void getIconPlacement(String displayRuleId, final Promise promise) {
925
949
  MPDisplayRule displayRule = getRule(displayRuleId);