@maplibre/maplibre-react-native 11.0.0-beta.27 → 11.0.0-beta.29
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/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +0 -2
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +1 -5
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +7 -0
- package/ios/components/annotations/point-annotation/MLRNPointAnnotation.m +39 -0
- package/lib/commonjs/components/annotations/marker/Marker.js +4 -0
- package/lib/commonjs/components/annotations/marker/Marker.js.map +1 -1
- package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js +5 -0
- package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js.map +1 -1
- package/lib/commonjs/components/camera/Camera.js +48 -0
- package/lib/commonjs/components/camera/Camera.js.map +1 -1
- package/lib/commonjs/components/images/Images.js +9 -0
- package/lib/commonjs/components/images/Images.js.map +1 -1
- package/lib/commonjs/components/layer/Layer.js +19 -8
- package/lib/commonjs/components/layer/Layer.js.map +1 -1
- package/lib/commonjs/components/map/Map.js +25 -1
- package/lib/commonjs/components/map/Map.js.map +1 -1
- package/lib/commonjs/components/sources/vector-source/VectorSource.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflineManager.js +46 -15
- package/lib/commonjs/modules/offline/OfflineManager.js.map +1 -1
- package/lib/commonjs/modules/static-map/StaticMapManager.js +13 -5
- package/lib/commonjs/modules/static-map/StaticMapManager.js.map +1 -1
- package/lib/commonjs/modules/transform-request/TransformRequestManager.js +7 -2
- package/lib/commonjs/modules/transform-request/TransformRequestManager.js.map +1 -1
- package/lib/commonjs/types/PressableSourceProps.js.map +1 -0
- package/lib/module/components/annotations/marker/Marker.js +4 -0
- package/lib/module/components/annotations/marker/Marker.js.map +1 -1
- package/lib/module/components/annotations/view-annotation/ViewAnnotation.js +5 -0
- package/lib/module/components/annotations/view-annotation/ViewAnnotation.js.map +1 -1
- package/lib/module/components/camera/Camera.js +48 -0
- package/lib/module/components/camera/Camera.js.map +1 -1
- package/lib/module/components/images/Images.js +9 -0
- package/lib/module/components/images/Images.js.map +1 -1
- package/lib/module/components/layer/Layer.js +19 -8
- package/lib/module/components/layer/Layer.js.map +1 -1
- package/lib/module/components/map/Map.js +25 -1
- package/lib/module/components/map/Map.js.map +1 -1
- package/lib/module/components/sources/vector-source/VectorSource.js.map +1 -1
- package/lib/module/modules/offline/OfflineManager.js +46 -15
- package/lib/module/modules/offline/OfflineManager.js.map +1 -1
- package/lib/module/modules/static-map/StaticMapManager.js +13 -5
- package/lib/module/modules/static-map/StaticMapManager.js.map +1 -1
- package/lib/module/modules/transform-request/TransformRequestManager.js +7 -2
- package/lib/module/modules/transform-request/TransformRequestManager.js.map +1 -1
- package/lib/module/types/PressableSourceProps.js.map +1 -0
- package/lib/typescript/commonjs/components/annotations/marker/Marker.d.ts +3 -0
- package/lib/typescript/commonjs/components/annotations/marker/Marker.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/annotations/view-annotation/ViewAnnotation.d.ts +3 -0
- package/lib/typescript/commonjs/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/camera/Camera.d.ts +70 -19
- package/lib/typescript/commonjs/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/images/Images.d.ts +7 -0
- package/lib/typescript/commonjs/components/images/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/layer/Layer.d.ts +19 -8
- package/lib/typescript/commonjs/components/layer/Layer.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/map/Map.d.ts +76 -30
- package/lib/typescript/commonjs/components/map/Map.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/geojson-source/GeoJSONSource.d.ts +1 -1
- package/lib/typescript/commonjs/components/sources/geojson-source/GeoJSONSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/vector-source/VectorSource.d.ts +9 -7
- package/lib/typescript/commonjs/components/sources/vector-source/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/offline/OfflineManager.d.ts +47 -16
- package/lib/typescript/commonjs/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/static-map/StaticMapManager.d.ts +13 -5
- package/lib/typescript/commonjs/modules/static-map/StaticMapManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts +7 -2
- package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/BaseProps.d.ts +3 -0
- package/lib/typescript/commonjs/types/BaseProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/PressEvent.d.ts +3 -0
- package/lib/typescript/commonjs/types/PressEvent.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/PressEventWithFeatures.d.ts +3 -0
- package/lib/typescript/commonjs/types/PressEventWithFeatures.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/{sources/PressableSourceProps.d.ts → PressableSourceProps.d.ts} +5 -2
- package/lib/typescript/commonjs/types/PressableSourceProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/ViewPadding.d.ts +3 -0
- package/lib/typescript/commonjs/types/ViewPadding.d.ts.map +1 -1
- package/lib/typescript/module/components/annotations/marker/Marker.d.ts +3 -0
- package/lib/typescript/module/components/annotations/marker/Marker.d.ts.map +1 -1
- package/lib/typescript/module/components/annotations/view-annotation/ViewAnnotation.d.ts +3 -0
- package/lib/typescript/module/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -1
- package/lib/typescript/module/components/camera/Camera.d.ts +70 -19
- package/lib/typescript/module/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/module/components/images/Images.d.ts +7 -0
- package/lib/typescript/module/components/images/Images.d.ts.map +1 -1
- package/lib/typescript/module/components/layer/Layer.d.ts +19 -8
- package/lib/typescript/module/components/layer/Layer.d.ts.map +1 -1
- package/lib/typescript/module/components/map/Map.d.ts +76 -30
- package/lib/typescript/module/components/map/Map.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/geojson-source/GeoJSONSource.d.ts +1 -1
- package/lib/typescript/module/components/sources/geojson-source/GeoJSONSource.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/vector-source/VectorSource.d.ts +9 -7
- package/lib/typescript/module/components/sources/vector-source/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/modules/offline/OfflineManager.d.ts +47 -16
- package/lib/typescript/module/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/module/modules/static-map/StaticMapManager.d.ts +13 -5
- package/lib/typescript/module/modules/static-map/StaticMapManager.d.ts.map +1 -1
- package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts +7 -2
- package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts.map +1 -1
- package/lib/typescript/module/types/BaseProps.d.ts +3 -0
- package/lib/typescript/module/types/BaseProps.d.ts.map +1 -1
- package/lib/typescript/module/types/PressEvent.d.ts +3 -0
- package/lib/typescript/module/types/PressEvent.d.ts.map +1 -1
- package/lib/typescript/module/types/PressEventWithFeatures.d.ts +3 -0
- package/lib/typescript/module/types/PressEventWithFeatures.d.ts.map +1 -1
- package/lib/typescript/module/types/{sources/PressableSourceProps.d.ts → PressableSourceProps.d.ts} +5 -2
- package/lib/typescript/module/types/PressableSourceProps.d.ts.map +1 -0
- package/lib/typescript/module/types/ViewPadding.d.ts +3 -0
- package/lib/typescript/module/types/ViewPadding.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/components/annotations/marker/Marker.tsx +3 -0
- package/src/components/annotations/view-annotation/ViewAnnotation.tsx +3 -0
- package/src/components/camera/Camera.tsx +70 -19
- package/src/components/images/Images.tsx +7 -0
- package/src/components/layer/Layer.tsx +19 -8
- package/src/components/map/Map.tsx +76 -30
- package/src/components/sources/geojson-source/GeoJSONSource.tsx +1 -1
- package/src/components/sources/vector-source/VectorSource.tsx +9 -7
- package/src/modules/offline/OfflineManager.ts +46 -15
- package/src/modules/static-map/StaticMapManager.ts +13 -5
- package/src/modules/transform-request/TransformRequestManager.ts +7 -2
- package/src/types/BaseProps.ts +3 -0
- package/src/types/PressEvent.ts +3 -0
- package/src/types/PressEventWithFeatures.ts +3 -0
- package/src/types/{sources/PressableSourceProps.ts → PressableSourceProps.ts} +5 -2
- package/src/types/ViewPadding.ts +3 -0
- package/lib/commonjs/types/sources/PressableSourceProps.js.map +0 -1
- package/lib/module/types/sources/PressableSourceProps.js.map +0 -1
- package/lib/typescript/commonjs/types/sources/PressableSourceProps.d.ts.map +0 -1
- package/lib/typescript/module/types/sources/PressableSourceProps.d.ts.map +0 -1
- /package/lib/commonjs/types/{sources/PressableSourceProps.js → PressableSourceProps.js} +0 -0
- /package/lib/module/types/{sources/PressableSourceProps.js → PressableSourceProps.js} +0 -0
|
@@ -28,6 +28,7 @@ import AndroidTextureMapViewNativeComponent from "./AndroidTextureMapViewNativeC
|
|
|
28
28
|
import MapViewNativeComponent from "./MapViewNativeComponent";
|
|
29
29
|
import NativeMapViewModule from "./NativeMapViewModule";
|
|
30
30
|
import { LogManager } from "../../modules/log/LogManager";
|
|
31
|
+
import type { BaseProps } from "../../types/BaseProps";
|
|
31
32
|
import type { LngLat } from "../../types/LngLat";
|
|
32
33
|
import type { LngLatBounds } from "../../types/LngLatBounds";
|
|
33
34
|
import type { PixelPoint } from "../../types/PixelPoint";
|
|
@@ -44,12 +45,19 @@ const styles = StyleSheet.create({
|
|
|
44
45
|
flex1: { flex: 1 },
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Screen position for map ornaments (logo, compass, scale bar). Exactly one of
|
|
50
|
+
* `top` / `bottom` and one of `left` / `right` must be provided.
|
|
51
|
+
*/
|
|
47
52
|
export type OrnamentViewPosition =
|
|
48
53
|
| { top: number; left: number }
|
|
49
54
|
| { top: number; right: number }
|
|
50
55
|
| { bottom: number; right: number }
|
|
51
56
|
| { bottom: number; left: number };
|
|
52
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Current viewport state of the map.
|
|
60
|
+
*/
|
|
53
61
|
export type ViewState = {
|
|
54
62
|
center: LngLat;
|
|
55
63
|
zoom: number;
|
|
@@ -58,11 +66,18 @@ export type ViewState = {
|
|
|
58
66
|
bounds: LngLatBounds;
|
|
59
67
|
};
|
|
60
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Event emitted when the map viewport changes (pan, zoom, rotate, pitch).
|
|
71
|
+
*/
|
|
61
72
|
export type ViewStateChangeEvent = ViewState & {
|
|
62
73
|
animated: boolean;
|
|
63
74
|
userInteraction: boolean;
|
|
64
75
|
};
|
|
65
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Options for querying rendered features at a screen point or within a bounding
|
|
79
|
+
* box.
|
|
80
|
+
*/
|
|
66
81
|
export type QueryRenderedFeaturesOptions = {
|
|
67
82
|
/**
|
|
68
83
|
* Filter expression to filter the queried features
|
|
@@ -82,7 +97,9 @@ export interface MapRef {
|
|
|
82
97
|
* @returns Current center coordinates of the map
|
|
83
98
|
*
|
|
84
99
|
* @example
|
|
100
|
+
* ```ts
|
|
85
101
|
* await mapRef.current?.getCenter();
|
|
102
|
+
* ```
|
|
86
103
|
*/
|
|
87
104
|
getCenter(): Promise<LngLat>;
|
|
88
105
|
|
|
@@ -92,7 +109,9 @@ export interface MapRef {
|
|
|
92
109
|
* @returns Current zoom level of the map
|
|
93
110
|
*
|
|
94
111
|
* @example
|
|
112
|
+
* ```ts
|
|
95
113
|
* await mapRef.current?.getZoom();
|
|
114
|
+
* ```
|
|
96
115
|
*/
|
|
97
116
|
getZoom(): Promise<number>;
|
|
98
117
|
|
|
@@ -102,7 +121,9 @@ export interface MapRef {
|
|
|
102
121
|
* @returns Current bearing of the map
|
|
103
122
|
*
|
|
104
123
|
* @example
|
|
124
|
+
* ```ts
|
|
105
125
|
* await mapRef.current?.getBearing();
|
|
126
|
+
* ```
|
|
106
127
|
*/
|
|
107
128
|
getBearing(): Promise<number>;
|
|
108
129
|
|
|
@@ -112,7 +133,9 @@ export interface MapRef {
|
|
|
112
133
|
* @returns Current pitch of the map
|
|
113
134
|
*
|
|
114
135
|
* @example
|
|
136
|
+
* ```ts
|
|
115
137
|
* await mapRef.current?.getPitch();
|
|
138
|
+
* ```
|
|
116
139
|
*/
|
|
117
140
|
getPitch(): Promise<number>;
|
|
118
141
|
|
|
@@ -122,7 +145,9 @@ export interface MapRef {
|
|
|
122
145
|
* @returns Current bounds of the map
|
|
123
146
|
*
|
|
124
147
|
* @example
|
|
148
|
+
* ```ts
|
|
125
149
|
* await mapRef.current?.getBounds();
|
|
150
|
+
* ```
|
|
126
151
|
*/
|
|
127
152
|
getBounds(): Promise<LngLatBounds>;
|
|
128
153
|
|
|
@@ -132,7 +157,9 @@ export interface MapRef {
|
|
|
132
157
|
* @returns Current view state of the map
|
|
133
158
|
*
|
|
134
159
|
* @example
|
|
160
|
+
* ```ts
|
|
135
161
|
* await mapRef.current?.getViewState();
|
|
162
|
+
* ```
|
|
136
163
|
*/
|
|
137
164
|
getViewState(): Promise<ViewState>;
|
|
138
165
|
|
|
@@ -143,7 +170,9 @@ export interface MapRef {
|
|
|
143
170
|
* @returns Pixel point
|
|
144
171
|
*
|
|
145
172
|
* @example
|
|
173
|
+
* ```ts
|
|
146
174
|
* await mapRef.current?.project([13.04214014753952, 47.80554907882145]);
|
|
175
|
+
* ```
|
|
147
176
|
*/
|
|
148
177
|
project(lngLat: LngLat): Promise<PixelPoint>;
|
|
149
178
|
|
|
@@ -154,7 +183,9 @@ export interface MapRef {
|
|
|
154
183
|
* @returns Geographic coordinate
|
|
155
184
|
*
|
|
156
185
|
* @example
|
|
186
|
+
* ```ts
|
|
157
187
|
* await mapRef.current?.unproject([280, 640]);
|
|
188
|
+
* ```
|
|
158
189
|
*/
|
|
159
190
|
unproject(point: PixelPoint): Promise<LngLat>;
|
|
160
191
|
|
|
@@ -164,13 +195,12 @@ export interface MapRef {
|
|
|
164
195
|
* @returns Queried features
|
|
165
196
|
*
|
|
166
197
|
* @example
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* );
|
|
198
|
+
* ```ts
|
|
199
|
+
* await mapRef.current?.queryRenderedFeatures([240, 640], {
|
|
200
|
+
* filter: ["==", "type", "Point"],
|
|
201
|
+
* layers: ["restaurants", "shops"],
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
174
204
|
*/
|
|
175
205
|
queryRenderedFeatures(
|
|
176
206
|
pixelPoint: PixelPoint,
|
|
@@ -183,13 +213,12 @@ export interface MapRef {
|
|
|
183
213
|
* @returns Queried features
|
|
184
214
|
*
|
|
185
215
|
* @example
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* );
|
|
216
|
+
* ```ts
|
|
217
|
+
* await mapRef.current?.queryRenderedFeatures([100, 100, 400, 400], {
|
|
218
|
+
* filter: ["==", "type", "Point"],
|
|
219
|
+
* layers: ["restaurants", "shops"],
|
|
220
|
+
* });
|
|
221
|
+
* ```
|
|
193
222
|
*/
|
|
194
223
|
queryRenderedFeatures(
|
|
195
224
|
pixelPointBounds: PixelPointBounds,
|
|
@@ -202,12 +231,12 @@ export interface MapRef {
|
|
|
202
231
|
* @returns Queried features
|
|
203
232
|
*
|
|
204
233
|
* @example
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
234
|
+
* ```ts
|
|
235
|
+
* await mapRef.current?.queryRenderedFeatures({
|
|
236
|
+
* filter: ["==", "type", "Point"],
|
|
237
|
+
* layers: ["restaurants", "shops"],
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
211
240
|
*/
|
|
212
241
|
queryRenderedFeatures(
|
|
213
242
|
options?: QueryRenderedFeaturesOptions,
|
|
@@ -229,7 +258,9 @@ export interface MapRef {
|
|
|
229
258
|
* @param sourceLayer - Identifier of the target source-layer (e.g. 'building')
|
|
230
259
|
*
|
|
231
260
|
* @example
|
|
232
|
-
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* await mapRef.current?.setSourceVisibility(false, "composite", "building");
|
|
263
|
+
* ```
|
|
233
264
|
*/
|
|
234
265
|
setSourceVisibility(
|
|
235
266
|
visible: boolean,
|
|
@@ -245,7 +276,7 @@ export interface MapRef {
|
|
|
245
276
|
showAttribution(): Promise<void>;
|
|
246
277
|
}
|
|
247
278
|
|
|
248
|
-
export interface MapProps extends ViewProps {
|
|
279
|
+
export interface MapProps extends BaseProps, ViewProps {
|
|
249
280
|
/**
|
|
250
281
|
* Style for wrapping React Native View
|
|
251
282
|
*
|
|
@@ -265,7 +296,9 @@ export interface MapProps extends ViewProps {
|
|
|
265
296
|
* Controls the light source for extruded geometries.
|
|
266
297
|
*
|
|
267
298
|
* @example
|
|
299
|
+
* ```tsx
|
|
268
300
|
* light={{ position: [1.5, 90, 80], color: "#ffffff", intensity: 0.5 }}
|
|
301
|
+
* ```
|
|
269
302
|
*/
|
|
270
303
|
light?: LightSpecification;
|
|
271
304
|
|
|
@@ -276,14 +309,14 @@ export interface MapProps extends ViewProps {
|
|
|
276
309
|
contentInset?: ViewPadding;
|
|
277
310
|
|
|
278
311
|
/**
|
|
279
|
-
* iOS
|
|
280
|
-
* value for this property is MLNMapViewPreferredFramesPerSecondDefault,
|
|
281
|
-
* will adaptively set the preferred frame rate based on the capability of
|
|
282
|
-
* user’s device to maintain a smooth experience. This property can be set
|
|
283
|
-
* arbitrary integer values.
|
|
312
|
+
* **iOS**: The preferred frame rate at which the map view is rendered. The
|
|
313
|
+
* default value for this property is MLNMapViewPreferredFramesPerSecondDefault,
|
|
314
|
+
* which will adaptively set the preferred frame rate based on the capability of
|
|
315
|
+
* the user’s device to maintain a smooth experience. This property can be set
|
|
316
|
+
* to arbitrary integer values.
|
|
284
317
|
*
|
|
285
|
-
* Android
|
|
286
|
-
* can't
|
|
318
|
+
* **Android**: The maximum frame rate at which the map view is rendered, but it
|
|
319
|
+
* can't exceed the ability of device hardware. This property can be set to
|
|
287
320
|
* arbitrary integer values.
|
|
288
321
|
*/
|
|
289
322
|
preferredFramesPerSecond?: number;
|
|
@@ -347,7 +380,9 @@ export interface MapProps extends ViewProps {
|
|
|
347
380
|
* Positions the attribution button
|
|
348
381
|
*
|
|
349
382
|
* @example Position in the top-left corner
|
|
383
|
+
* ```ts
|
|
350
384
|
* { top: 8, left: 8 }
|
|
385
|
+
* ```
|
|
351
386
|
*/
|
|
352
387
|
attributionPosition?: OrnamentViewPosition;
|
|
353
388
|
|
|
@@ -360,7 +395,9 @@ export interface MapProps extends ViewProps {
|
|
|
360
395
|
* Positions the logo
|
|
361
396
|
*
|
|
362
397
|
* @example Position in the top-left corner
|
|
398
|
+
* ```ts
|
|
363
399
|
* { top: 8, left: 8 }
|
|
400
|
+
* ```
|
|
364
401
|
*/
|
|
365
402
|
logoPosition?: OrnamentViewPosition;
|
|
366
403
|
|
|
@@ -373,7 +410,9 @@ export interface MapProps extends ViewProps {
|
|
|
373
410
|
* Positions the compass
|
|
374
411
|
*
|
|
375
412
|
* @example Position in the top-left corner
|
|
413
|
+
* ```ts
|
|
376
414
|
* { top: 8, left: 8 }
|
|
415
|
+
* ```
|
|
377
416
|
*/
|
|
378
417
|
compassPosition?: OrnamentViewPosition;
|
|
379
418
|
|
|
@@ -393,7 +432,9 @@ export interface MapProps extends ViewProps {
|
|
|
393
432
|
* Positions the scale bar. Android only supports top-left corner.
|
|
394
433
|
*
|
|
395
434
|
* @example Position in the bottom-left corner
|
|
435
|
+
* ```ts
|
|
396
436
|
* { bottom: 8, left: 8 }
|
|
437
|
+
* ```
|
|
397
438
|
*/
|
|
398
439
|
scaleBarPosition?: OrnamentViewPosition;
|
|
399
440
|
|
|
@@ -501,7 +542,12 @@ export interface MapProps extends ViewProps {
|
|
|
501
542
|
}
|
|
502
543
|
|
|
503
544
|
/**
|
|
504
|
-
* MapLibre Native Map
|
|
545
|
+
* A view of a MapLibre Native Map.
|
|
546
|
+
*
|
|
547
|
+
* @example Rendering a basic Map
|
|
548
|
+
* ```tsx
|
|
549
|
+
* <Map mapStyle="https://demotiles.maplibre.org/style.json" />;
|
|
550
|
+
* ```
|
|
505
551
|
*/
|
|
506
552
|
export const Map = memo(
|
|
507
553
|
({ androidView = "surface", style, ref, ...props }: MapProps) => {
|
|
@@ -17,7 +17,7 @@ import GeoJSONSourceNativeComponent from "./GeoJSONSourceNativeComponent";
|
|
|
17
17
|
import NativeGeoJSONSourceModule from "./NativeGeoJSONSourceModule";
|
|
18
18
|
import { useFrozenId } from "../../../hooks/useFrozenId";
|
|
19
19
|
import { type BaseProps } from "../../../types/BaseProps";
|
|
20
|
-
import type { PressableSourceProps } from "../../../types/
|
|
20
|
+
import type { PressableSourceProps } from "../../../types/PressableSourceProps";
|
|
21
21
|
import { cloneReactChildrenWithProps } from "../../../utils";
|
|
22
22
|
import { findNodeHandle } from "../../../utils/findNodeHandle";
|
|
23
23
|
import { getNativeFilter } from "../../../utils/getNativeFilter";
|
|
@@ -14,20 +14,22 @@ import NativeVectorSourceModule from "./NativeVectorSourceModule";
|
|
|
14
14
|
import VectorSourceNativeComponent from "./VectorSourceNativeComponent";
|
|
15
15
|
import { useFrozenId } from "../../../hooks/useFrozenId";
|
|
16
16
|
import { type BaseProps } from "../../../types/BaseProps";
|
|
17
|
-
import type { PressableSourceProps } from "../../../types/
|
|
17
|
+
import type { PressableSourceProps } from "../../../types/PressableSourceProps";
|
|
18
18
|
import { cloneReactChildrenWithProps } from "../../../utils";
|
|
19
19
|
import { findNodeHandle } from "../../../utils/findNodeHandle";
|
|
20
20
|
import { getNativeFilter } from "../../../utils/getNativeFilter";
|
|
21
21
|
|
|
22
22
|
export interface VectorSourceRef {
|
|
23
23
|
/**
|
|
24
|
-
* Returns all features that match the query parameters regardless of whether
|
|
25
|
-
*
|
|
24
|
+
* Returns all features that match the query parameters regardless of whether
|
|
25
|
+
* the feature is currently rendered on the map. The domain of the query
|
|
26
26
|
* includes all currently-loaded vector tiles and GeoJSON source tiles. This
|
|
27
|
-
* function does not check tiles outside
|
|
27
|
+
* function does not check tiles outside the visible viewport.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
|
-
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* vectorSource.querySourceFeatures({ sourceLayer: "some-source-layer" });
|
|
32
|
+
* ```
|
|
31
33
|
*/
|
|
32
34
|
querySourceFeatures(options: {
|
|
33
35
|
sourceLayer: string;
|
|
@@ -49,8 +51,8 @@ export interface VectorSourceProps extends BaseProps, PressableSourceProps {
|
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* An array of tile URL templates. If multiple endpoints are specified, clients
|
|
52
|
-
* may use any combination of endpoints.
|
|
53
|
-
* https://example.com/vector-tiles/{z}/{x}/{y}.pbf
|
|
54
|
+
* may use any combination of endpoints. Common format should be:
|
|
55
|
+
* `https://example.com/vector-tiles/{z}/{x}/{y}.pbf` .
|
|
54
56
|
*/
|
|
55
57
|
tiles?: string[];
|
|
56
58
|
|
|
@@ -83,16 +83,24 @@ class OfflineManager {
|
|
|
83
83
|
* @returns The created offline pack with its generated ID.
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
|
-
*
|
|
87
|
-
* const
|
|
86
|
+
* ```ts
|
|
87
|
+
* const progressListener = (offlineRegion, status) =>
|
|
88
|
+
* console.log(offlineRegion, status);
|
|
89
|
+
* const errorListener = (offlineRegion, error) =>
|
|
90
|
+
* console.log(offlineRegion, error);
|
|
88
91
|
*
|
|
89
|
-
* const offlinePack = await OfflineManager.createPack(
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* },
|
|
92
|
+
* const offlinePack = await OfflineManager.createPack(
|
|
93
|
+
* {
|
|
94
|
+
* mapStyle: "https://demotiles.maplibre.org/tiles/tiles.json",
|
|
95
|
+
* minZoom: 14,
|
|
96
|
+
* maxZoom: 20,
|
|
97
|
+
* bounds: [west, south, east, north],
|
|
98
|
+
* metadata: { customValue: "myValue" },
|
|
99
|
+
* },
|
|
100
|
+
* progressListener,
|
|
101
|
+
* errorListener,
|
|
102
|
+
* );
|
|
103
|
+
* ```
|
|
96
104
|
*/
|
|
97
105
|
async createPack(
|
|
98
106
|
options: OfflinePackCreateOptions,
|
|
@@ -131,7 +139,9 @@ class OfflineManager {
|
|
|
131
139
|
* @param id - ID of the OfflinePack.
|
|
132
140
|
*
|
|
133
141
|
* @example
|
|
134
|
-
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* await OfflineManager.invalidatePack(pack.id);
|
|
144
|
+
* ```
|
|
135
145
|
*/
|
|
136
146
|
async invalidatePack(id: string): Promise<void> {
|
|
137
147
|
await this.initialize();
|
|
@@ -147,7 +157,9 @@ class OfflineManager {
|
|
|
147
157
|
* @param id - ID of the OfflinePack.
|
|
148
158
|
*
|
|
149
159
|
* @example
|
|
150
|
-
*
|
|
160
|
+
* ```ts
|
|
161
|
+
* await OfflineManager.deletePack(pack.id);
|
|
162
|
+
* ```
|
|
151
163
|
*/
|
|
152
164
|
async deletePack(id: string): Promise<void> {
|
|
153
165
|
await this.initialize();
|
|
@@ -167,7 +179,9 @@ class OfflineManager {
|
|
|
167
179
|
* effects.
|
|
168
180
|
*
|
|
169
181
|
* @example
|
|
182
|
+
* ```ts
|
|
170
183
|
* await OfflineManager.invalidateAmbientCache();
|
|
184
|
+
* ```
|
|
171
185
|
*/
|
|
172
186
|
async invalidateAmbientCache(): Promise<void> {
|
|
173
187
|
await this.initialize();
|
|
@@ -179,7 +193,9 @@ class OfflineManager {
|
|
|
179
193
|
* decreases the amount of space that map resources take up on the device.
|
|
180
194
|
*
|
|
181
195
|
* @example
|
|
196
|
+
* ```ts
|
|
182
197
|
* await OfflineManager.clearAmbientCache();
|
|
198
|
+
* ```
|
|
183
199
|
*/
|
|
184
200
|
async clearAmbientCache(): Promise<void> {
|
|
185
201
|
await this.initialize();
|
|
@@ -206,7 +222,9 @@ class OfflineManager {
|
|
|
206
222
|
* offline packs, then reinitializes it.
|
|
207
223
|
*
|
|
208
224
|
* @example
|
|
225
|
+
* ```ts
|
|
209
226
|
* await OfflineManager.resetDatabase();
|
|
227
|
+
* ```
|
|
210
228
|
*/
|
|
211
229
|
async resetDatabase(): Promise<void> {
|
|
212
230
|
await this.initialize();
|
|
@@ -229,7 +247,9 @@ class OfflineManager {
|
|
|
229
247
|
* Retrieves an offline pack that is stored in the database by ID.
|
|
230
248
|
*
|
|
231
249
|
* @example
|
|
250
|
+
* ```ts
|
|
232
251
|
* const offlinePack = await OfflineManager.getPack(offlinePack.id);
|
|
252
|
+
* ```
|
|
233
253
|
*/
|
|
234
254
|
async getPack(id: string): Promise<OfflinePack> {
|
|
235
255
|
await this.initialize();
|
|
@@ -248,7 +268,9 @@ class OfflineManager {
|
|
|
248
268
|
* @param path - Path to offline tile db on file system.
|
|
249
269
|
*
|
|
250
270
|
* @example
|
|
271
|
+
* ```ts
|
|
251
272
|
* await OfflineManager.mergeOfflineRegions(path);
|
|
273
|
+
* ```
|
|
252
274
|
*/
|
|
253
275
|
async mergeOfflineRegions(path: string): Promise<void> {
|
|
254
276
|
await this.initialize();
|
|
@@ -263,7 +285,9 @@ class OfflineManager {
|
|
|
263
285
|
* @param limit - Map tile limit count.
|
|
264
286
|
*
|
|
265
287
|
* @example
|
|
288
|
+
* ```ts
|
|
266
289
|
* OfflineManager.setTileCountLimit(1000);
|
|
290
|
+
* ```
|
|
267
291
|
*/
|
|
268
292
|
setTileCountLimit(limit: number): void {
|
|
269
293
|
NativeOfflineModule.setTileCountLimit(limit);
|
|
@@ -276,7 +300,9 @@ class OfflineManager {
|
|
|
276
300
|
* @param throttleValue - Event throttle value in ms.
|
|
277
301
|
*
|
|
278
302
|
* @example
|
|
303
|
+
* ```ts
|
|
279
304
|
* OfflineManager.setProgressEventThrottle(500);
|
|
305
|
+
* ```
|
|
280
306
|
*/
|
|
281
307
|
setProgressEventThrottle(throttleValue: number): void {
|
|
282
308
|
NativeOfflineModule.setProgressEventThrottle(throttleValue);
|
|
@@ -293,9 +319,12 @@ class OfflineManager {
|
|
|
293
319
|
* resource.
|
|
294
320
|
*
|
|
295
321
|
* @example
|
|
296
|
-
*
|
|
297
|
-
* const
|
|
298
|
-
*
|
|
322
|
+
* ```ts
|
|
323
|
+
* const progressListener = (offlinePack, status) =>
|
|
324
|
+
* console.log(offlinePack, status);
|
|
325
|
+
* const errorListener = (offlinePack, error) => console.log(offlinePack, error);
|
|
326
|
+
* OfflineManager.addListener(pack.id, progressListener, errorListener);
|
|
327
|
+
* ```
|
|
299
328
|
*/
|
|
300
329
|
async addListener(
|
|
301
330
|
id: string,
|
|
@@ -328,11 +357,13 @@ class OfflineManager {
|
|
|
328
357
|
* @param packId - ID of the offline pack.
|
|
329
358
|
*
|
|
330
359
|
* @example
|
|
360
|
+
* ```ts
|
|
331
361
|
* useEffect(() => {
|
|
332
362
|
* return () => {
|
|
333
363
|
* OfflineManager.removeListener(pack.id);
|
|
334
|
-
* }
|
|
364
|
+
* };
|
|
335
365
|
* }, []);
|
|
366
|
+
* ```
|
|
336
367
|
*/
|
|
337
368
|
removeListener(packId: string): void {
|
|
338
369
|
delete this.progressListeners[packId];
|
|
@@ -81,10 +81,12 @@ class StaticMapManager {
|
|
|
81
81
|
/**
|
|
82
82
|
* Creates a static image of a map. Images are always in PNG format.
|
|
83
83
|
*
|
|
84
|
-
* @
|
|
85
|
-
*
|
|
84
|
+
* @param options -
|
|
85
|
+
*
|
|
86
|
+
* @example Create static map with center, returning the URI to the temporary PNG file
|
|
87
|
+
* ```ts
|
|
86
88
|
* const uri = await StaticMapManager.createImage({
|
|
87
|
-
* center: [-74.
|
|
89
|
+
* center: [-74.12641, 40.797968],
|
|
88
90
|
* zoom: 12,
|
|
89
91
|
* bearing: 20,
|
|
90
92
|
* pitch: 30,
|
|
@@ -93,15 +95,21 @@ class StaticMapManager {
|
|
|
93
95
|
* height: 64,
|
|
94
96
|
* output: "file",
|
|
95
97
|
* });
|
|
98
|
+
* ```
|
|
96
99
|
*
|
|
97
|
-
*
|
|
100
|
+
* @example Create a static map with bounds, returning a base64 encoded PNG
|
|
101
|
+
* ```ts
|
|
98
102
|
* const uri = await StaticMapManager.createImage({
|
|
99
|
-
* bounds: [
|
|
103
|
+
* bounds: [
|
|
104
|
+
* [-74.12641, 40.797968],
|
|
105
|
+
* [-74.143727, 40.772177],
|
|
106
|
+
* ],
|
|
100
107
|
* mapStyle: "https://demotiles.maplibre.org/style.json",
|
|
101
108
|
* width: 128,
|
|
102
109
|
* height: 64,
|
|
103
110
|
* output: "base64",
|
|
104
111
|
* });
|
|
112
|
+
* ```
|
|
105
113
|
*/
|
|
106
114
|
async createImage({
|
|
107
115
|
mapStyle,
|
|
@@ -175,8 +175,13 @@ class TransformRequestManager {
|
|
|
175
175
|
* });
|
|
176
176
|
* ```
|
|
177
177
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
178
|
+
* @example Add apiKey to all requests (no match = applies to all)
|
|
179
|
+
* ```ts
|
|
180
|
+
* TransformRequestManager.addUrlSearchParam({
|
|
181
|
+
* name: "apiKey",
|
|
182
|
+
* value: "your-api-key",
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
180
185
|
*/
|
|
181
186
|
addUrlSearchParam(options: UrlSearchParamOptions): string {
|
|
182
187
|
const id = options.id ?? this.getId();
|
package/src/types/BaseProps.ts
CHANGED
package/src/types/PressEvent.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { NativeSyntheticEvent } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { PressEventWithFeatures } from "
|
|
4
|
-
import type { ViewPadding } from "
|
|
3
|
+
import type { PressEventWithFeatures } from "./PressEventWithFeatures";
|
|
4
|
+
import type { ViewPadding } from "./ViewPadding";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Props shared by source components that support press interactions.
|
|
8
|
+
*/
|
|
6
9
|
export interface PressableSourceProps {
|
|
7
10
|
/**
|
|
8
11
|
* Emits on press when a child `Layer` within the hitbox has highest z-index
|
package/src/types/ViewPadding.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/sources/PressableSourceProps.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/sources/PressableSourceProps.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PressableSourceProps.d.ts","sourceRoot":"","sources":["../../../../../src/types/sources/PressableSourceProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IAExE;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PressableSourceProps.d.ts","sourceRoot":"","sources":["../../../../../src/types/sources/PressableSourceProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IAExE;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
File without changes
|
|
File without changes
|