@nativescript-community/ui-mapbox 7.0.13 → 7.0.15

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.0.15](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.14...v7.0.15) (2026-03-10)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-mapbox
9
+
10
+ ## [7.0.14](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.13...v7.0.14) (2026-01-23)
11
+
12
+ **Note:** Version bump only for package @nativescript-community/ui-mapbox
13
+
6
14
  ## [7.0.13](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.12...v7.0.13) (2026-01-21)
7
15
 
8
16
  ### Bug Fixes
@@ -132,6 +132,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
132
132
  [k: string]: ImageSource;
133
133
  };
134
134
  constructor(view: any);
135
+ getMapInstance(): com.mapbox.maps.MapboxMap;
135
136
  /**
136
137
  * not used
137
138
  */
@@ -153,7 +154,6 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
153
154
  *
154
155
  * @see MapboxView::init()
155
156
  *
156
- * @todo FIXME: the timeout delay before showing the map works around some race condition. The source error needs to be figured out.
157
157
  */
158
158
  show(options: ShowOptions): Promise<ShowResult>;
159
159
  /**
@@ -161,7 +161,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
161
161
  */
162
162
  hide(): Promise<void>;
163
163
  unhide(): Promise<void>;
164
- destroy(nativeMap?: any): Promise<void>;
164
+ destroy(nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
165
165
  /**
166
166
  * Clear Event Listeners
167
167
  *
@@ -171,9 +171,9 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
171
171
  * idea to remove these handlers explicitly.
172
172
  */
173
173
  private clearEventListeners;
174
- onStart(nativeMap?: any): Promise<void>;
175
- onStop(nativeMap?: any): Promise<void>;
176
- onDestroy(nativeMap?: any): Promise<void>;
174
+ onStart(nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
175
+ onStop(nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
176
+ onDestroy(nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
177
177
  /**
178
178
  * event handler shim
179
179
  *
@@ -235,21 +235,21 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
235
235
  * @link https://docs.mapbox.com/android/api/map-sdk/7.1.2/com/mapbox/mapboxsdk/maps/MapboxMap.html#setStyle-java.lang.String-com.mapbox.maps.Style.OnStyleLoaded-
236
236
  */
237
237
  setMapStyle(style: string | MapStyle, nativeMapViewInstance?: any): Promise<void>;
238
- getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
239
- addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
240
- removeImage(imageId: string, nativeMap?: any): Promise<void>;
238
+ getImage(imageId: string, nativeMap?: com.mapbox.maps.MapboxMap): Promise<ImageSource>;
239
+ addImage(imageId: string, imagePath: string, nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
240
+ removeImage(imageId: string, nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
241
241
  /**
242
242
  *
243
243
  * @deprecated
244
244
  * @link https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation
245
245
  */
246
- addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise<void>;
246
+ addMarkers(markers: MapboxMarker[], nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
247
247
  /**
248
248
  *
249
249
  * @deprecated
250
250
  * @link https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation
251
251
  */
252
- removeMarkers(ids?: any, nativeMap?: any): Promise<void>;
252
+ removeMarkers(ids?: any, nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
253
253
  iconCache: {
254
254
  [k: string]: ImageSource;
255
255
  };
@@ -289,7 +289,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
289
289
  removePolygons(ids?: any[], nativeMap?: any): Promise<void>;
290
290
  removePolylines(ids?: any[], nativeMap?: any): Promise<void>;
291
291
  animateCamera(options: AnimateCameraOptions, nativeMap?: any): Promise<void>;
292
- setOnMapClickListener(listener: (data: LatLng) => boolean, nativeMap?: any): Promise<void>;
292
+ setOnMapClickListener(listener: (data: LatLng) => boolean, nativeMap?: com.mapbox.maps.MapboxMap): Promise<void>;
293
293
  setOnMapLongClickListener(listener: (data: LatLng) => boolean, nativeMap?: any): Promise<void>;
294
294
  setOnMoveBeginListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
295
295
  setOnMoveEndListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise<void>;
@@ -451,8 +451,8 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
451
451
  * @todo figure out why the user location marker is not updating.
452
452
  */
453
453
  forceUserLocationUpdate(location: any, nativeMap?: any): Promise<void>;
454
- getLayer(name: string, nativeMap?: any): Promise<LayerCommon>;
455
- getLayers(nativeMap?: any): Promise<LayerCommon[]>;
454
+ getLayer(name: string, nativeMap?: com.mapbox.maps.MapboxMap): Promise<LayerCommon>;
455
+ getLayers(nativeMap?: com.mapbox.maps.MapboxMap): Promise<LayerCommon[]>;
456
456
  _getClickedMarkerDetails(clicked: AndroidMarker): MapboxMarker;
457
457
  _downloadImage(marker: MapboxMarker): Promise<MapboxMarker>;
458
458
  _downloadMarkerImages(markers: MapboxMarker[]): Promise<MapboxMarker[]>;
package/index.android.js CHANGED
@@ -129,7 +129,7 @@ export class MapboxView extends MapboxViewBase {
129
129
  this.settings = settings;
130
130
  }
131
131
  getNativeMapView() {
132
- return this.nativeMapView;
132
+ return this.mapbox.getMapInstance();
133
133
  }
134
134
  /**
135
135
  * Return the Mapbox() API Shim instance
@@ -383,6 +383,9 @@ export class Mapbox extends MapboxCommon {
383
383
  CLog(CLogTypes.info, 'constructor(): end of Mapbox constructor.');
384
384
  }
385
385
  }
386
+ getMapInstance() {
387
+ return this._mapboxMapInstance;
388
+ }
386
389
  /**
387
390
  * not used
388
391
  */
@@ -404,7 +407,6 @@ export class Mapbox extends MapboxCommon {
404
407
  *
405
408
  * @see MapboxView::init()
406
409
  *
407
- * @todo FIXME: the timeout delay before showing the map works around some race condition. The source error needs to be figured out.
408
410
  */
409
411
  async show(options) {
410
412
  return new Promise((resolve, reject) => {
@@ -572,9 +574,6 @@ export class Mapbox extends MapboxCommon {
572
574
  if (Trace.isEnabled()) {
573
575
  CLog(CLogTypes.info, 'show(): showIt() bottom');
574
576
  }
575
- // };
576
- // FIXME: There is some initialization error. A short delay works around this.
577
- // setTimeout(showIt, settings.delay ? settings.delay : 200);
578
577
  }
579
578
  catch (ex) {
580
579
  if (Trace.isEnabled()) {
@@ -971,9 +970,14 @@ export class Mapbox extends MapboxCommon {
971
970
  return;
972
971
  }
973
972
  try {
974
- const nativeImage = theMap.getStyle().getImage(imageId);
975
- const img = new ImageSource(nativeImage);
976
- resolve(img);
973
+ const nativeImage = theMap.getStyle().getStyleImage(imageId);
974
+ if (nativeImage) {
975
+ const img = new ImageSource(nativeImage);
976
+ resolve(img);
977
+ }
978
+ else {
979
+ resolve(null);
980
+ }
977
981
  }
978
982
  catch (ex) {
979
983
  reject('Error during getImage: ' + ex);
@@ -993,7 +997,10 @@ export class Mapbox extends MapboxCommon {
993
997
  }
994
998
  try {
995
999
  const imageSource = await this.fetchImageSource(imagePath);
996
- theMap.getStyle().addImage(imageId, imageSource.android);
1000
+ const ImageExtensionImpl = com.mapbox.maps.extension.style.image.ImageExtensionImpl;
1001
+ const imageBuilder = new ImageExtensionImpl.Builder(imageId, imageSource.android);
1002
+ const image = imageBuilder.build();
1003
+ image.bindTo(theMap.getStyle());
997
1004
  resolve();
998
1005
  }
999
1006
  catch (ex) {
@@ -1013,7 +1020,7 @@ export class Mapbox extends MapboxCommon {
1013
1020
  return;
1014
1021
  }
1015
1022
  try {
1016
- theMap.getStyle().removeImage(imageId);
1023
+ theMap.getStyle().removeStyleImage(imageId);
1017
1024
  resolve();
1018
1025
  }
1019
1026
  catch (ex) {
@@ -2202,6 +2209,7 @@ export class Mapbox extends MapboxCommon {
2202
2209
  addSource(id, options, nativeMap) {
2203
2210
  return new Promise((resolve, reject) => {
2204
2211
  try {
2212
+ console.log('addSource', nativeMap, this._mapboxMapInstance, new Error().stack);
2205
2213
  const theMap = nativeMap || this._mapboxMapInstance;
2206
2214
  let source;
2207
2215
  if (!theMap) {
@@ -2415,6 +2423,7 @@ export class Mapbox extends MapboxCommon {
2415
2423
  }
2416
2424
  }
2417
2425
  getSource(sId, mapboxInstance = this._mapboxMapInstance) {
2426
+ console.log('getSource', mapboxInstance);
2418
2427
  // TODO: missing extension typings
2419
2428
  //@ts-ignore
2420
2429
  return mapboxInstance.getStyle().getSource(sId);
package/index.ios.js CHANGED
@@ -1270,38 +1270,13 @@ export class Mapbox extends MapboxCommon {
1270
1270
  return new Promise((resolve, reject) => {
1271
1271
  try {
1272
1272
  const b = nativeMap ? MapboxBridge.bridgeFor(nativeMap) : this.bridgeInstance;
1273
- if (!b || !b.getImage) {
1273
+ if (!b) {
1274
1274
  resolve(null);
1275
1275
  return;
1276
1276
  }
1277
1277
  // The native bridge now returns a UIImage (native iOS object) or null.
1278
1278
  const nativeImage = b.getImage(imageId);
1279
- if (!nativeImage) {
1280
- resolve(null);
1281
- return;
1282
- }
1283
- // Wrap the native UIImage into a NativeScript ImageSource
1284
- try {
1285
- // ImageSource.fromNativeSource accepts a native UIImage on iOS
1286
- const imgSrc = new ImageSource(nativeImage);
1287
- resolve(imgSrc || null);
1288
- }
1289
- catch (err) {
1290
- // As a fallback, if the bridge returns base64 string (older fallback), try decode
1291
- try {
1292
- const maybeBase64 = nativeImage;
1293
- if (typeof maybeBase64 === 'string') {
1294
- const src = ImageSource.fromBase64Sync ? ImageSource.fromBase64Sync(maybeBase64) : ImageSource.fromBase64(maybeBase64);
1295
- resolve(src || null);
1296
- }
1297
- else {
1298
- resolve(null);
1299
- }
1300
- }
1301
- catch (e) {
1302
- resolve(null);
1303
- }
1304
- }
1279
+ resolve(nativeImage ? new ImageSource(nativeImage) : null);
1305
1280
  }
1306
1281
  catch (ex) {
1307
1282
  reject(ex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-mapbox",
3
- "version": "7.0.13",
3
+ "version": "7.0.15",
4
4
  "description": "Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.",
5
5
  "main": "index",
6
6
  "typings": "index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "dependencies": {
56
56
  "@nativescript-community/perms": "^3.0.4"
57
57
  },
58
- "gitHead": "1b4fd085a73303d0fa91057927000be6ea24b30f"
58
+ "gitHead": "cc3330eb0279ee483dd0f617fb5104e4d85c7aae"
59
59
  }