@mapsindoors/react-native-maps-indoors-mapbox 2.10.0 → 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.
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,10 +2,38 @@
2
2
 
3
3
  ## Documentation
4
4
 
5
- Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.10.0/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.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
+
9
37
  ### [2.10.0] - 2026-11-02
10
38
 
11
39
  #### Added
@@ -218,6 +246,13 @@ end
218
246
  ...
219
247
  ```
220
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
+
221
256
  #### Providing API key
222
257
 
223
258
  Navigate to your application settings and add your Mapbox public access token to info with the key `MBXAccessToken`
@@ -94,7 +94,7 @@ dependencies {
94
94
  }
95
95
 
96
96
  implementation 'com.mapbox.maps:android-ndk27:11.16.1'
97
- implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.23.0'
97
+ implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.24.2'
98
98
  implementation 'com.facebook.react:react-native:+' // From node_modules
99
99
  implementation 'androidx.core:core-ktx:1.3.2'
100
100
  implementation 'com.github.bumptech.glide:glide:4.16.0'
@@ -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);
@@ -579,6 +579,15 @@
579
579
  resolver:(RCTPromiseResolveBlock) resolve
580
580
  rejecter:(RCTPromiseRejectBlock) reject)
581
581
 
582
+ RCT_EXTERN_METHOD(getIconZoomFactor: (NSString *) displayRuleId
583
+ resolver:(RCTPromiseResolveBlock) resolve
584
+ rejecter:(RCTPromiseRejectBlock) reject)
585
+
586
+ RCT_EXTERN_METHOD(setIconZoomFactor: (NSString *) displayRuleId
587
+ value:(nonnull NSNumber *) value
588
+ resolver:(RCTPromiseResolveBlock) resolve
589
+ rejecter:(RCTPromiseRejectBlock) reject)
590
+
582
591
  RCT_EXTERN_METHOD(getBadgeScale: (NSString *) displayRuleId
583
592
  resolver:(RCTPromiseResolveBlock) resolve
584
593
  rejecter:(RCTPromiseRejectBlock) reject)
@@ -1454,6 +1454,24 @@ public class MPDisplayRuleModule: NSObject {
1454
1454
  return resolve(nil)
1455
1455
  }
1456
1456
 
1457
+ @objc public func getIconZoomFactor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1458
+ guard let displayRule = getRule(name: displayRuleId) else {
1459
+ return doReject(reject, displayRuleId: displayRuleId)
1460
+ }
1461
+
1462
+ return resolve(displayRule.iconZoomFactor)
1463
+ }
1464
+
1465
+ @objc public func setIconZoomFactor(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1466
+ guard let displayRule = getRule(name: displayRuleId) else {
1467
+ return doReject(reject, displayRuleId: displayRuleId)
1468
+ }
1469
+
1470
+ displayRule.iconZoomFactor = value.doubleValue
1471
+
1472
+ return resolve(nil)
1473
+ }
1474
+
1457
1475
  @objc public func getBadgeScale(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1458
1476
  guard let displayRule = getRule(name: displayRuleId) else {
1459
1477
  return doReject(reject, displayRuleId: displayRuleId)
@@ -2,6 +2,9 @@ import Foundation
2
2
  import MapsIndoors
3
3
  import MapsIndoorsCodable
4
4
  import MapsIndoorsCore
5
+ #if canImport(MapsIndoorsMapbox)
6
+ import MapsIndoorsMapbox
7
+ #endif
5
8
  import React
6
9
 
7
10
  @objc(MapsIndoorsModule)
@@ -474,6 +477,15 @@ public class MapsIndoorsModule: RCTEventEmitter {
474
477
  }
475
478
 
476
479
  Task {
480
+ // The SDK otherwise registers its base-map cache only when MapControl.create builds the
481
+ // map provider, so caching before the first map rejected with 9000 (SPEX-2895). A no-op
482
+ // once a map has registered its own. The SDK declares it @MainActor, since the Mapbox
483
+ // objects it creates belong to their creating thread; the await hops there. The token
484
+ // comes from Info.plist's MBXAccessToken, which Mapbox reads by itself.
485
+ #if canImport(MapsIndoorsMapbox)
486
+ await MPMapsIndoors.registerMapboxBaseMapCache()
487
+ #endif
488
+
477
489
  do {
478
490
  if apiKeys == nil {
479
491
  try await datasetCacheManager.synchronizeBaseMapTiles(progress: progress)
@@ -0,0 +1 @@
1
+ // SwiftPM requires a public headers directory; the bridge targets export no headers.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapsindoors/react-native-maps-indoors-mapbox",
3
3
  "title": "React Native MapsIndoors Mapbox",
4
- "version": "2.10.0",
4
+ "version": "2.11.0",
5
5
  "description": "React Native MapsIndoors component with mapbox",
6
6
  "react-native": "index.ts",
7
7
  "files": [
@@ -17,7 +17,8 @@
17
17
  "!ios/core/Tests",
18
18
  "!ios/core/.build",
19
19
  "!android/build",
20
- "app.plugin.js"
20
+ "app.plugin.js",
21
+ "Package.swift"
21
22
  ],
22
23
  "scripts": {
23
24
  "test": "jest",
@@ -62,5 +63,8 @@
62
63
  "android": {
63
64
  "javaPackageName": "com.mapsindoorsrn"
64
65
  }
66
+ },
67
+ "swiftpmConfig": {
68
+ "name": "ReactNativeMapsIndoorsMapbox"
65
69
  }
66
70
  }
@@ -24,19 +24,16 @@ Pod::Spec.new do |s|
24
24
  # ios/core carries a SwiftPM manifest and unit tests for its React-free helpers (SPEX-2686). They
25
25
  # are run with `swift test` in that repository and must not be compiled into the pod, nor must the
26
26
  # build products `swift test` leaves in .build (they include a generated `@main` test runner).
27
- s.exclude_files = "ios/core/Package.swift", "ios/core/Tests/**/*", "ios/core/.build/**/*"
27
+ s.exclude_files = "ios/core/Package.swift", "ios/core/Tests/**/*", "ios/core/.build/**/*", "ios/spm-bridges/**/*"
28
28
  s.requires_arc = true
29
29
 
30
30
  install_modules_dependencies(s)
31
31
 
32
- # MapsIndoors' iOS SDK is consumed via CocoaPods, which resolves MapsIndoorsCore and MapboxMaps
33
- # 11.x transitively and embeds them into the consuming app.
34
- #
35
- # This deliberately does *not* use the Swift Package Manager integration introduced in SPEX-889:
36
- # `spm_dependency` attaches the packages to the Pods project's own target, and nothing then
37
- # embeds the resulting dynamic frameworks into the app bundle, so the app builds and links but
38
- # dies at launch with `Library not loaded: @rpath/MapsIndoorsCore.framework/MapsIndoorsCore`.
39
- # See SPEX-2429 before reintroducing SPM here.
40
- s.dependency "MapsIndoorsMapbox11", "4.23.0"
41
- s.dependency "MapsIndoorsCodable", "4.23.0"
32
+ # CocoaPods apps get the MapsIndoors SDK as pods, which embed into the app. Do not switch to
33
+ # `spm_dependency`: it attaches the packages to the Pods project's own target, nothing embeds the
34
+ # frameworks, and the app dies at launch with `Library not loaded: @rpath/MapsIndoorsCore...`
35
+ # (SPEX-2429). Apps on React Native's SwiftPM mode (0.88+) use Package.swift instead, which must
36
+ # name the same SDK version.
37
+ s.dependency "MapsIndoorsMapbox11", "4.24.1"
38
+ s.dependency "MapsIndoorsCodable", "4.24.1"
42
39
  end
@@ -33,6 +33,8 @@ export interface Spec extends TurboModule {
33
33
  setIconSize(displayRuleId: string, size: string): Promise<null>;
34
34
  getIconScale(displayRuleId: string): Promise<number | null>;
35
35
  setIconScale(displayRuleId: string, scale: number): Promise<null>;
36
+ getIconZoomFactor(displayRuleId: string): Promise<number>;
37
+ setIconZoomFactor(displayRuleId: string, factor: number): Promise<null>;
36
38
  getIconPlacement(displayRuleId: string): Promise<number | null>;
37
39
  setIconPlacement(displayRuleId: string, placement: number): Promise<null>;
38
40
 
@@ -247,7 +247,8 @@ export default class MPBuilding extends MPEntity {
247
247
  "anchor": this.anchor.toJSON(),
248
248
  "buildingInfo": this.buildingInfo,
249
249
  "geometry": this.geometry,
250
- "floors": this._floors,
250
+ // JSON.stringify writes a Map as {}. Keys become strings, as the native SDKs send them.
251
+ "floors": Object.fromEntries(this._floors),
251
252
  "defaultFloor": this.defaultFloor,
252
253
  "address": this.address,
253
254
  "boundingBox": this.bounds.toJSON()
@@ -1103,6 +1103,31 @@ export default class MPDisplayRule {
1103
1103
  });
1104
1104
  }
1105
1105
 
1106
+ /**
1107
+ * Get the factor the icon grows to across the solution's icon zoom range. Defaults to 1.
1108
+ * @returns Promise<number>
1109
+ */
1110
+ public async getIconZoomFactor(): Promise<number> {
1111
+ return DisplayRule.getIconZoomFactor(this.id).catch((err: Error) => {
1112
+ return Promise.reject(MPError.create(JSON.parse(err.message)));
1113
+ });
1114
+ }
1115
+
1116
+ /**
1117
+ * Set the factor the icon grows to across the solution's icon zoom range.
1118
+ * It must be finite and within 0 < factor <= 4; any other value is ignored with a warning.
1119
+ * @returns Promise<void>
1120
+ */
1121
+ public async setIconZoomFactor(factor: number): Promise<void> {
1122
+ if (!Number.isFinite(factor) || factor <= 0 || factor > 4) {
1123
+ console.warn(`MapsIndoors: ignoring iconZoomFactor ${factor}, must be finite and within 0 < factor <= 4`);
1124
+ return;
1125
+ }
1126
+ return DisplayRule.setIconZoomFactor(this.id, factor).catch((err: Error) => {
1127
+ return Promise.reject(MPError.create(JSON.parse(err.message)));
1128
+ });
1129
+ }
1130
+
1106
1131
  /**
1107
1132
  * Get the icon's anchor value.
1108
1133
  * @returns Promise<MPIconAnchor>
@@ -119,6 +119,31 @@ export default class MPFloor extends MPEntity {
119
119
  return this.geometry!.bounds.center;
120
120
  }
121
121
 
122
+ /**
123
+ * Writes the floor in the shape the native SDKs send it.
124
+ *
125
+ * Omits `geometry` when it has no coordinates: iOS sends none for a floor whose backend geometry
126
+ * is a single Polygon (SPEX-1803), and decodes a present `geometry` strictly, so sending an empty
127
+ * one would fail the whole building. `entityBounds` carries the extent instead, as native sends it.
128
+ *
129
+ * @public
130
+ * @returns {object}
131
+ */
132
+ public toJSON(): object {
133
+ const bbox = this.geometry?.bbox;
134
+ const hasBounds = Array.isArray(bbox) && bbox.length === 4 && bbox.every(Number.isFinite);
135
+ return {
136
+ type: this.type,
137
+ id: this.id,
138
+ name: this.name,
139
+ ...(this.geometry?.coordinates ? { geometry: this.geometry } : {}),
140
+ aliases: this.aliases,
141
+ floorIndex: this.floorIndex,
142
+ buildingId: this.buildingId,
143
+ ...(hasBounds ? { entityBounds: this.geometry!.bounds.toJSON() } : {}),
144
+ };
145
+ }
146
+
122
147
  }
123
148
 
124
149
  /**
@@ -26,6 +26,8 @@ export default class MPSolutionConfig {
26
26
  * @param {?MPCollisionHandling} [_mpCollisionHandling]
27
27
  * @param {?boolean} [_isNewSelection]
28
28
  * @param {?number} [_automatedZoomLimit]
29
+ * @param {?number} [_iconScaleZoomFrom]
30
+ * @param {?number} [_iconScaleZoomTo]
29
31
  */
30
32
  private constructor(
31
33
  public readonly id: string,
@@ -35,6 +37,8 @@ export default class MPSolutionConfig {
35
37
  private _mpCollisionHandling?: MPCollisionHandling,
36
38
  private _isNewSelection?: boolean,
37
39
  private _automatedZoomLimit?: number,
40
+ private _iconScaleZoomFrom?: number,
41
+ private _iconScaleZoomTo?: number,
38
42
  ) { }
39
43
 
40
44
 
@@ -55,6 +59,8 @@ export default class MPSolutionConfig {
55
59
  object?.collisionHandling,
56
60
  object?.isNewSelection,
57
61
  object?.automatedZoomLimit,
62
+ object?.iconScaleZoomFrom,
63
+ object?.iconScaleZoomTo,
58
64
  );
59
65
  }
60
66
 
@@ -131,6 +137,28 @@ export default class MPSolutionConfig {
131
137
  public set selectable(selectable: boolean | undefined) {
132
138
  this.locationSettings.selectable = selectable;
133
139
  }
140
+
141
+ /**
142
+ * Get the MapsIndoors zoom where icons start to grow towards their display rule's icon zoom
143
+ * factor, as the solution stores it. Undefined when not set.
144
+ *
145
+ * @public
146
+ * @type {number | undefined}
147
+ */
148
+ public get iconScaleZoomFrom(): number | undefined {
149
+ return this._iconScaleZoomFrom;
150
+ }
151
+
152
+ /**
153
+ * Get the MapsIndoors zoom where icons reach their display rule's icon zoom factor, as the
154
+ * solution stores it. Undefined when not set.
155
+ *
156
+ * @public
157
+ * @type {number | undefined}
158
+ */
159
+ public get iconScaleZoomTo(): number | undefined {
160
+ return this._iconScaleZoomTo;
161
+ }
134
162
  }
135
163
 
136
164
  /**
@@ -185,4 +213,18 @@ export interface MPSolutionConfigParams {
185
213
  * @type {number}
186
214
  */
187
215
  automatedZoomLimit?: number,
216
+
217
+ /**
218
+ * Start of the icon zoom range
219
+ *
220
+ * @type {?number}
221
+ */
222
+ iconScaleZoomFrom?: number,
223
+
224
+ /**
225
+ * End of the icon zoom range
226
+ *
227
+ * @type {?number}
228
+ */
229
+ iconScaleZoomTo?: number,
188
230
  }
@@ -700,10 +700,9 @@ export default class MapsIndoors {
700
700
  * This runs independently of {@link synchronizeContent} and {@link cacheData}, which cache the
701
701
  * MapsIndoors content itself. Both are needed for a fully offline map.
702
702
  *
703
- * On iOS, a {@link MapView} has to have been mounted at least once first: the iOS SDK registers
704
- * its base-map cache when it builds the map provider, and until then this rejects with
705
- * {@link MPError.baseMapCachingNotSupported} even on Mapbox. Android has no such ordering
706
- * requirement.
703
+ * Works before any {@link MapView} exists, so tiles can be cached ahead of the first map. On
704
+ * iOS, until `MapControl.create` has run this caches the MapsIndoors Mapbox style, so an app
705
+ * rendering its own style should call `MapControl.create` before syncing.
707
706
  *
708
707
  * Run one call at a time. Progress arrives on a single channel carrying only the fraction, with
709
708
  * nothing identifying the call, so two overlapping calls interleave their progress - including