@maplibre/maplibre-react-native 11.0.0-alpha.21 → 11.0.0-alpha.22
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/components/camera/CameraStop.kt +2 -3
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +53 -50
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +35 -26
- package/android/src/main/java/org/maplibre/reactnative/events/FeatureClickEvent.java +5 -8
- package/android/src/main/java/org/maplibre/reactnative/utils/ConvertUtils.java +2 -2
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +7 -9
- package/ios/components/camera/CameraStop.m +2 -2
- package/ios/components/camera/MLRNCameraComponentView.mm +7 -9
- package/ios/components/camera/MLRNCameraModule.mm +3 -3
- package/ios/components/map-view/MLRNMapTouchEvent.m +14 -8
- package/ios/components/map-view/MLRNMapView.m +16 -10
- package/ios/components/map-view/MLRNMapViewComponentView.mm +24 -30
- package/ios/components/map-view/MLRNMapViewManager.h +8 -8
- package/ios/components/map-view/MLRNMapViewManager.m +23 -34
- package/ios/components/map-view/MLRNMapViewModule.mm +40 -36
- package/lib/commonjs/components/camera/Camera.js +15 -15
- package/lib/commonjs/components/camera/Camera.js.map +1 -1
- package/lib/commonjs/components/camera/CameraNativeComponent.ts +1 -2
- package/lib/commonjs/components/camera/NativeCameraModule.js.map +1 -1
- package/lib/commonjs/components/map-view/MapView.js +8 -11
- package/lib/commonjs/components/map-view/MapView.js.map +1 -1
- package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +7 -6
- package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/LngLat.js +2 -0
- package/lib/commonjs/types/{Bounds.js.map → LngLat.js.map} +1 -1
- package/lib/commonjs/types/LngLatBounds.js +2 -0
- package/lib/commonjs/types/LngLatBounds.js.map +1 -0
- package/lib/commonjs/types/PixelPoint.js +2 -0
- package/lib/commonjs/types/PixelPoint.js.map +1 -0
- package/lib/commonjs/types/PixelPointBounds.js +2 -0
- package/lib/commonjs/types/PixelPointBounds.js.map +1 -0
- package/lib/commonjs/types/PressEvent.js +4 -0
- package/lib/module/components/camera/Camera.js +15 -15
- package/lib/module/components/camera/Camera.js.map +1 -1
- package/lib/module/components/camera/CameraNativeComponent.ts +1 -2
- package/lib/module/components/camera/NativeCameraModule.js.map +1 -1
- package/lib/module/components/map-view/MapView.js +8 -11
- package/lib/module/components/map-view/MapView.js.map +1 -1
- package/lib/module/components/map-view/MapViewNativeComponent.ts +7 -6
- package/lib/module/components/map-view/NativeMapViewModule.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/LngLat.js +2 -0
- package/lib/module/types/{Bounds.js.map → LngLat.js.map} +1 -1
- package/lib/module/types/LngLatBounds.js +2 -0
- package/lib/module/types/LngLatBounds.js.map +1 -0
- package/lib/module/types/PixelPoint.js +2 -0
- package/lib/module/types/PixelPoint.js.map +1 -0
- package/lib/module/types/PixelPointBounds.js +2 -0
- package/lib/module/types/PixelPointBounds.js.map +1 -0
- package/lib/module/types/PressEvent.js +2 -0
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts +15 -21
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +66 -42
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +9 -6
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts +12 -26
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +6 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/LngLat.d.ts +5 -0
- package/lib/typescript/commonjs/src/types/LngLat.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/LngLatBounds.d.ts +12 -0
- package/lib/typescript/commonjs/src/types/LngLatBounds.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PixelPoint.d.ts +5 -0
- package/lib/typescript/commonjs/src/types/PixelPoint.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PixelPointBounds.d.ts +10 -0
- package/lib/typescript/commonjs/src/types/PixelPointBounds.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts +6 -6
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts.map +1 -1
- package/lib/typescript/module/src/components/camera/Camera.d.ts +15 -21
- package/lib/typescript/module/src/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts +1 -2
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts +1 -2
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/MapView.d.ts +66 -42
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +9 -6
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts +12 -26
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +6 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/LngLat.d.ts +5 -0
- package/lib/typescript/module/src/types/LngLat.d.ts.map +1 -0
- package/lib/typescript/module/src/types/LngLatBounds.d.ts +12 -0
- package/lib/typescript/module/src/types/LngLatBounds.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PixelPoint.d.ts +5 -0
- package/lib/typescript/module/src/types/PixelPoint.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PixelPointBounds.d.ts +10 -0
- package/lib/typescript/module/src/types/PixelPointBounds.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PressEvent.d.ts +6 -6
- package/lib/typescript/module/src/types/PressEvent.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/camera/Camera.tsx +24 -26
- package/src/components/camera/CameraNativeComponent.ts +1 -2
- package/src/components/camera/NativeCameraModule.ts +1 -2
- package/src/components/map-view/MapView.tsx +106 -62
- package/src/components/map-view/MapViewNativeComponent.ts +7 -6
- package/src/components/map-view/NativeMapViewModule.ts +23 -28
- package/src/index.ts +8 -4
- package/src/types/LngLat.ts +4 -0
- package/src/types/LngLatBounds.ts +11 -0
- package/src/types/PixelPoint.ts +4 -0
- package/src/types/PixelPointBounds.ts +9 -0
- package/src/types/PressEvent.ts +7 -8
- package/lib/commonjs/types/Bounds.js +0 -2
- package/lib/module/types/Bounds.js +0 -2
- package/lib/typescript/commonjs/src/types/Bounds.d.ts +0 -2
- package/lib/typescript/commonjs/src/types/Bounds.d.ts.map +0 -1
- package/lib/typescript/module/src/types/Bounds.d.ts +0 -2
- package/lib/typescript/module/src/types/Bounds.d.ts.map +0 -1
- package/src/types/Bounds.ts +0 -1
|
@@ -13,8 +13,7 @@ type NativeViewPadding = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
type NativeViewState = {
|
|
16
|
-
|
|
17
|
-
latitude?: CodegenTypes.WithDefault<CodegenTypes.Double, -360>;
|
|
16
|
+
center?: CodegenTypes.Double[];
|
|
18
17
|
|
|
19
18
|
bounds?: CodegenTypes.Double[];
|
|
20
19
|
|
|
@@ -29,11 +29,14 @@ import MapViewNativeComponent, {
|
|
|
29
29
|
import NativeMapViewModule from "./NativeMapViewModule";
|
|
30
30
|
import { LogManager } from "../../modules/log/LogManager";
|
|
31
31
|
import { type BaseProps } from "../../types/BaseProps";
|
|
32
|
-
import type {
|
|
32
|
+
import type { LngLat } from "../../types/LngLat";
|
|
33
|
+
import type { LngLatBounds } from "../../types/LngLatBounds";
|
|
33
34
|
import {
|
|
34
35
|
type FilterExpression,
|
|
35
36
|
type LightLayerStyle,
|
|
36
37
|
} from "../../types/MapLibreRNStyles";
|
|
38
|
+
import type { PixelPoint } from "../../types/PixelPoint";
|
|
39
|
+
import type { PixelPointBounds } from "../../types/PixelPointBounds";
|
|
37
40
|
import type { PressEvent } from "../../types/PressEvent";
|
|
38
41
|
import type { ViewPadding } from "../../types/ViewPadding";
|
|
39
42
|
import { isAndroid } from "../../utils";
|
|
@@ -76,12 +79,11 @@ export type OrnamentViewPosition =
|
|
|
76
79
|
| { bottom: number; left: number };
|
|
77
80
|
|
|
78
81
|
export type ViewState = {
|
|
79
|
-
|
|
80
|
-
latitude: number;
|
|
82
|
+
center: LngLat;
|
|
81
83
|
zoom: number;
|
|
82
84
|
bearing: number;
|
|
83
85
|
pitch: number;
|
|
84
|
-
bounds:
|
|
86
|
+
bounds: LngLatBounds;
|
|
85
87
|
};
|
|
86
88
|
|
|
87
89
|
export type ViewStateChangeEvent = ViewState & {
|
|
@@ -90,7 +92,14 @@ export type ViewStateChangeEvent = ViewState & {
|
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
export type QueryRenderedFeaturesOptions = {
|
|
95
|
+
/**
|
|
96
|
+
* Filter expression to filter the queried features
|
|
97
|
+
*/
|
|
93
98
|
filter?: FilterExpression;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* IDs of layers to query features from
|
|
102
|
+
*/
|
|
94
103
|
layers?: string[];
|
|
95
104
|
};
|
|
96
105
|
|
|
@@ -103,7 +112,7 @@ export interface MapViewRef {
|
|
|
103
112
|
*
|
|
104
113
|
* @return Current center coordinates of the map
|
|
105
114
|
*/
|
|
106
|
-
getCenter(): Promise<
|
|
115
|
+
getCenter(): Promise<LngLat>;
|
|
107
116
|
|
|
108
117
|
/**
|
|
109
118
|
* Returns the current zoom level of the map
|
|
@@ -113,7 +122,7 @@ export interface MapViewRef {
|
|
|
113
122
|
*
|
|
114
123
|
* @return Current zoom level of the map
|
|
115
124
|
*/
|
|
116
|
-
getZoom(): Promise<
|
|
125
|
+
getZoom(): Promise<number>;
|
|
117
126
|
|
|
118
127
|
/**
|
|
119
128
|
* Returns the current bearing of the map
|
|
@@ -123,7 +132,7 @@ export interface MapViewRef {
|
|
|
123
132
|
*
|
|
124
133
|
* @return Current bearing of the map
|
|
125
134
|
*/
|
|
126
|
-
getBearing(): Promise<
|
|
135
|
+
getBearing(): Promise<number>;
|
|
127
136
|
|
|
128
137
|
/**
|
|
129
138
|
* Returns the current pitch of the map
|
|
@@ -133,7 +142,7 @@ export interface MapViewRef {
|
|
|
133
142
|
*
|
|
134
143
|
* @return Current pitch of the map
|
|
135
144
|
*/
|
|
136
|
-
getPitch(): Promise<
|
|
145
|
+
getPitch(): Promise<number>;
|
|
137
146
|
|
|
138
147
|
/**
|
|
139
148
|
* Returns the current bounds of the map
|
|
@@ -143,7 +152,7 @@ export interface MapViewRef {
|
|
|
143
152
|
*
|
|
144
153
|
* @return Current bounds of the map
|
|
145
154
|
*/
|
|
146
|
-
getBounds(): Promise<
|
|
155
|
+
getBounds(): Promise<LngLatBounds>;
|
|
147
156
|
|
|
148
157
|
/**
|
|
149
158
|
* Returns the current view state of the map
|
|
@@ -156,54 +165,81 @@ export interface MapViewRef {
|
|
|
156
165
|
getViewState(): Promise<ViewState>;
|
|
157
166
|
|
|
158
167
|
/**
|
|
159
|
-
* Converts
|
|
168
|
+
* Converts geographic coordinates to pixel point of the view
|
|
160
169
|
*
|
|
161
170
|
* @example
|
|
162
171
|
* await mapViewRef.current?.getPointInView([-37.817070, 144.949901]);
|
|
163
172
|
*
|
|
164
|
-
* @param
|
|
173
|
+
* @param coordinates Geographic coordinate
|
|
165
174
|
* @return Pixel point
|
|
166
175
|
*/
|
|
167
|
-
project(
|
|
168
|
-
longitude: number;
|
|
169
|
-
latitude: number;
|
|
170
|
-
}): Promise<{ locationX: number; locationY: number }>;
|
|
176
|
+
project(coordinates: LngLat): Promise<PixelPoint>;
|
|
171
177
|
|
|
172
178
|
/**
|
|
173
|
-
* Converts a pixel point of the view to
|
|
179
|
+
* Converts a pixel point of the view to geographic coordinates.
|
|
174
180
|
*
|
|
175
181
|
* @example
|
|
176
|
-
* await mapViewRef.current?.getCoordinateFromView([
|
|
182
|
+
* await mapViewRef.current?.getCoordinateFromView([280, 640]);
|
|
177
183
|
*
|
|
178
184
|
* @param point Pixel point
|
|
179
185
|
* @return Geographic coordinate
|
|
180
186
|
*/
|
|
181
|
-
unproject(point:
|
|
182
|
-
locationX: number;
|
|
183
|
-
locationY: number;
|
|
184
|
-
}): Promise<{ longitude: number; latitude: number }>;
|
|
187
|
+
unproject(point: PixelPoint): Promise<LngLat>;
|
|
185
188
|
|
|
186
189
|
/**
|
|
187
|
-
*
|
|
190
|
+
* Query rendered features at a point
|
|
188
191
|
*
|
|
189
192
|
* @example
|
|
190
|
-
* await mapViewRef.current?.
|
|
193
|
+
* await mapViewRef.current?.queryRenderedFeatures(
|
|
194
|
+
* [240, 640],
|
|
195
|
+
* {
|
|
196
|
+
* filter: ["==", "type", "Point"],
|
|
197
|
+
* layers: ["restaurants", "shops"],
|
|
198
|
+
* },
|
|
199
|
+
* );
|
|
191
200
|
*
|
|
192
|
-
* @
|
|
193
|
-
* @param options.layers - A array of layer id's to filter the features by
|
|
194
|
-
* @return FeatureCollection containing queried features
|
|
201
|
+
* @return Queried features
|
|
195
202
|
*/
|
|
196
203
|
queryRenderedFeatures(
|
|
197
|
-
|
|
204
|
+
pixelPoint: PixelPoint,
|
|
198
205
|
options?: QueryRenderedFeaturesOptions,
|
|
199
|
-
): Promise<GeoJSON.
|
|
206
|
+
): Promise<GeoJSON.Feature[]>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Query rendered features within pixel bounds
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* await mapViewRef.current?.queryRenderedFeatures(
|
|
213
|
+
* [100, 100, 400, 400],
|
|
214
|
+
* {
|
|
215
|
+
* filter: ["==", "type", "Point"],
|
|
216
|
+
* layers: ["restaurants", "shops"],
|
|
217
|
+
* },
|
|
218
|
+
* );
|
|
219
|
+
*
|
|
220
|
+
* @return Queried features
|
|
221
|
+
*/
|
|
200
222
|
queryRenderedFeatures(
|
|
201
|
-
|
|
223
|
+
pixelPointBounds: PixelPointBounds,
|
|
202
224
|
options?: QueryRenderedFeaturesOptions,
|
|
203
|
-
): Promise<GeoJSON.
|
|
225
|
+
): Promise<GeoJSON.Feature[]>;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Query rendered features within the current viewport
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* await mapViewRef.current?.queryRenderedFeatures(
|
|
232
|
+
* {
|
|
233
|
+
* filter: ["==", "type", "Point"],
|
|
234
|
+
* layers: ["restaurants", "shops"],
|
|
235
|
+
* },
|
|
236
|
+
* );
|
|
237
|
+
*
|
|
238
|
+
* @return Queried features
|
|
239
|
+
*/
|
|
204
240
|
queryRenderedFeatures(
|
|
205
241
|
options?: QueryRenderedFeaturesOptions,
|
|
206
|
-
): Promise<GeoJSON.
|
|
242
|
+
): Promise<GeoJSON.Feature[]>;
|
|
207
243
|
|
|
208
244
|
/**
|
|
209
245
|
* Takes snapshot of map with current tiles and returns a URI to the image
|
|
@@ -229,13 +265,14 @@ export interface MapViewRef {
|
|
|
229
265
|
): Promise<void>;
|
|
230
266
|
|
|
231
267
|
/**
|
|
232
|
-
* Show the attribution
|
|
233
|
-
*
|
|
268
|
+
* Show the attribution dialog
|
|
269
|
+
*
|
|
270
|
+
* Can be used to implement a custom attribution button.
|
|
234
271
|
*/
|
|
235
272
|
showAttribution(): Promise<void>;
|
|
236
273
|
}
|
|
237
274
|
|
|
238
|
-
interface MapViewProps extends BaseProps {
|
|
275
|
+
export interface MapViewProps extends BaseProps {
|
|
239
276
|
children?: ReactNode;
|
|
240
277
|
|
|
241
278
|
/**
|
|
@@ -444,7 +481,7 @@ interface MapViewProps extends BaseProps {
|
|
|
444
481
|
*/
|
|
445
482
|
export const MapView = memo(
|
|
446
483
|
forwardRef<MapViewRef, MapViewProps>(
|
|
447
|
-
({ androidView = "surface", style,
|
|
484
|
+
({ androidView = "surface", style, ...props }, ref) => {
|
|
448
485
|
const [isReady, setIsReady] = useState(false);
|
|
449
486
|
|
|
450
487
|
const nativeRef = useRef<
|
|
@@ -466,19 +503,17 @@ export const MapView = memo(
|
|
|
466
503
|
NativeMapViewModule.getPitch(findNodeHandle(nativeRef.current)),
|
|
467
504
|
|
|
468
505
|
getBounds: () =>
|
|
469
|
-
NativeMapViewModule.getBounds(
|
|
470
|
-
findNodeHandle(nativeRef.current),
|
|
471
|
-
) as Promise<Bounds>,
|
|
506
|
+
NativeMapViewModule.getBounds(findNodeHandle(nativeRef.current)),
|
|
472
507
|
|
|
473
508
|
getViewState: () =>
|
|
474
509
|
NativeMapViewModule.getViewState(
|
|
475
510
|
findNodeHandle(nativeRef.current),
|
|
476
511
|
) as Promise<ViewState>,
|
|
477
512
|
|
|
478
|
-
project: (
|
|
513
|
+
project: (lngLat) =>
|
|
479
514
|
NativeMapViewModule.project(
|
|
480
515
|
findNodeHandle(nativeRef.current),
|
|
481
|
-
|
|
516
|
+
lngLat,
|
|
482
517
|
),
|
|
483
518
|
|
|
484
519
|
unproject: (point) =>
|
|
@@ -488,40 +523,49 @@ export const MapView = memo(
|
|
|
488
523
|
),
|
|
489
524
|
|
|
490
525
|
queryRenderedFeatures: async (
|
|
491
|
-
|
|
492
|
-
|
|
|
493
|
-
|
|
|
526
|
+
pixelPointOrPixelPointBoundsOrOptions?:
|
|
527
|
+
| PixelPoint
|
|
528
|
+
| PixelPointBounds
|
|
494
529
|
| QueryRenderedFeaturesOptions,
|
|
495
530
|
options?: QueryRenderedFeaturesOptions,
|
|
496
531
|
) => {
|
|
497
532
|
if (
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
533
|
+
pixelPointOrPixelPointBoundsOrOptions &&
|
|
534
|
+
Array.isArray(pixelPointOrPixelPointBoundsOrOptions) &&
|
|
535
|
+
((value: PixelPoint | PixelPointBounds): value is PixelPoint =>
|
|
536
|
+
typeof value[0] === "number" && typeof value[1] === "number")(
|
|
537
|
+
pixelPointOrPixelPointBoundsOrOptions,
|
|
538
|
+
)
|
|
501
539
|
) {
|
|
502
|
-
return
|
|
540
|
+
return await NativeMapViewModule.queryRenderedFeaturesWithPoint(
|
|
503
541
|
findNodeHandle(nativeRef.current),
|
|
504
|
-
|
|
542
|
+
pixelPointOrPixelPointBoundsOrOptions,
|
|
505
543
|
options?.layers ?? [],
|
|
506
544
|
getFilter(options?.filter),
|
|
507
|
-
)
|
|
508
|
-
} else if (
|
|
509
|
-
|
|
545
|
+
);
|
|
546
|
+
} else if (
|
|
547
|
+
pixelPointOrPixelPointBoundsOrOptions &&
|
|
548
|
+
Array.isArray(pixelPointOrPixelPointBoundsOrOptions) &&
|
|
549
|
+
((
|
|
550
|
+
value: PixelPoint | PixelPointBounds,
|
|
551
|
+
): value is PixelPointBounds =>
|
|
552
|
+
Array.isArray(value[0]) && Array.isArray(value[1]))(
|
|
553
|
+
pixelPointOrPixelPointBoundsOrOptions,
|
|
554
|
+
)
|
|
555
|
+
) {
|
|
556
|
+
return await NativeMapViewModule.queryRenderedFeaturesWithBounds(
|
|
510
557
|
findNodeHandle(nativeRef.current),
|
|
511
|
-
|
|
558
|
+
pixelPointOrPixelPointBoundsOrOptions,
|
|
512
559
|
options?.layers ?? [],
|
|
513
560
|
getFilter(options?.filter),
|
|
514
|
-
)
|
|
561
|
+
);
|
|
515
562
|
} else {
|
|
516
|
-
return
|
|
563
|
+
return await NativeMapViewModule.queryRenderedFeaturesWithBounds(
|
|
517
564
|
findNodeHandle(nativeRef.current),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
options?.layers ?? [],
|
|
523
|
-
getFilter(options?.filter),
|
|
524
|
-
)) as GeoJSON.FeatureCollection;
|
|
565
|
+
null,
|
|
566
|
+
pixelPointOrPixelPointBoundsOrOptions?.layers ?? [],
|
|
567
|
+
getFilter(pixelPointOrPixelPointBoundsOrOptions?.filter),
|
|
568
|
+
);
|
|
525
569
|
}
|
|
526
570
|
},
|
|
527
571
|
|
|
@@ -592,7 +636,7 @@ export const MapView = memo(
|
|
|
592
636
|
<View
|
|
593
637
|
onLayout={() => setIsReady(true)}
|
|
594
638
|
style={style ?? styles.flex1}
|
|
595
|
-
testID={
|
|
639
|
+
testID={nativeProps.testID ? `${nativeProps.testID}View` : undefined}
|
|
596
640
|
>
|
|
597
641
|
{mapView}
|
|
598
642
|
</View>
|
|
@@ -24,15 +24,16 @@ type NativeOrnamentViewPosition = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
type NativePressEvent = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
lngLat: UnsafeMixed<
|
|
28
|
+
[longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
|
|
29
|
+
>;
|
|
30
|
+
point: UnsafeMixed<[x: CodegenTypes.Double, y: CodegenTypes.Double]>;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
type NativeViewStateEvent = {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
center: UnsafeMixed<
|
|
35
|
+
[longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
|
|
36
|
+
>;
|
|
36
37
|
zoom: CodegenTypes.Double;
|
|
37
38
|
bearing: CodegenTypes.Double;
|
|
38
39
|
pitch: CodegenTypes.Double;
|
|
@@ -5,8 +5,7 @@ import {
|
|
|
5
5
|
} from "react-native";
|
|
6
6
|
|
|
7
7
|
type NativeViewState = {
|
|
8
|
-
|
|
9
|
-
latitude: CodegenTypes.Double;
|
|
8
|
+
center: CodegenTypes.Double[];
|
|
10
9
|
zoom: CodegenTypes.Double;
|
|
11
10
|
bearing: CodegenTypes.Double;
|
|
12
11
|
pitch: CodegenTypes.Double;
|
|
@@ -14,10 +13,9 @@ type NativeViewState = {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export interface Spec extends TurboModule {
|
|
17
|
-
getCenter: (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}>;
|
|
16
|
+
getCenter: (
|
|
17
|
+
reactTag: CodegenTypes.Int32,
|
|
18
|
+
) => Promise<[longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]>;
|
|
21
19
|
|
|
22
20
|
getZoom: (reactTag: CodegenTypes.Int32) => Promise<CodegenTypes.Double>;
|
|
23
21
|
|
|
@@ -25,45 +23,42 @@ export interface Spec extends TurboModule {
|
|
|
25
23
|
|
|
26
24
|
getPitch: (reactTag: CodegenTypes.Int32) => Promise<CodegenTypes.Double>;
|
|
27
25
|
|
|
28
|
-
getBounds: (
|
|
26
|
+
getBounds: (
|
|
27
|
+
reactTag: CodegenTypes.Int32,
|
|
28
|
+
) => Promise<
|
|
29
|
+
[
|
|
30
|
+
west: CodegenTypes.Double,
|
|
31
|
+
south: CodegenTypes.Double,
|
|
32
|
+
east: CodegenTypes.Double,
|
|
33
|
+
north: CodegenTypes.Double,
|
|
34
|
+
]
|
|
35
|
+
>;
|
|
29
36
|
|
|
30
37
|
getViewState: (reactTag: CodegenTypes.Int32) => Promise<NativeViewState>;
|
|
31
38
|
|
|
32
39
|
project: (
|
|
33
40
|
reactTag: CodegenTypes.Int32,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
latitude: CodegenTypes.Double;
|
|
37
|
-
},
|
|
38
|
-
) => Promise<{
|
|
39
|
-
locationX: CodegenTypes.Double;
|
|
40
|
-
locationY: CodegenTypes.Double;
|
|
41
|
-
}>;
|
|
41
|
+
lngLat: CodegenTypes.Double[],
|
|
42
|
+
) => Promise<[x: CodegenTypes.Double, y: CodegenTypes.Double]>;
|
|
42
43
|
|
|
43
44
|
unproject: (
|
|
44
45
|
reactTag: CodegenTypes.Int32,
|
|
45
|
-
|
|
46
|
-
) => Promise<
|
|
47
|
-
longitude: CodegenTypes.Double;
|
|
48
|
-
latitude: CodegenTypes.Double;
|
|
49
|
-
}>;
|
|
46
|
+
pixelPoint: CodegenTypes.Double[],
|
|
47
|
+
) => Promise<[longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]>;
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
queryRenderedFeaturesWithPoint: (
|
|
52
50
|
reactTag: CodegenTypes.Int32,
|
|
53
|
-
|
|
54
|
-
longitude: CodegenTypes.Double;
|
|
55
|
-
latitude: CodegenTypes.Double;
|
|
56
|
-
},
|
|
51
|
+
pixelPoint: CodegenTypes.Double[],
|
|
57
52
|
layers: string[],
|
|
58
53
|
filter: string[],
|
|
59
|
-
) => Promise<
|
|
54
|
+
) => Promise<GeoJSON.Feature[]>;
|
|
60
55
|
|
|
61
56
|
queryRenderedFeaturesWithBounds: (
|
|
62
57
|
reactTag: CodegenTypes.Int32,
|
|
63
|
-
|
|
58
|
+
pixelPointBounds: CodegenTypes.Double[][] | null,
|
|
64
59
|
layers: string[],
|
|
65
60
|
filter: string[],
|
|
66
|
-
) => Promise<
|
|
61
|
+
) => Promise<GeoJSON.Feature[]>;
|
|
67
62
|
|
|
68
63
|
setSourceVisibility: (
|
|
69
64
|
reactTag: CodegenTypes.Int32,
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from "./MLRNModule";
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
+
Camera,
|
|
5
|
+
type CameraProps,
|
|
6
|
+
type CameraRef,
|
|
4
7
|
type CameraOptions,
|
|
5
8
|
type CameraEasing,
|
|
6
9
|
type CameraAnimationOptions,
|
|
@@ -10,15 +13,13 @@ export {
|
|
|
10
13
|
type CameraBoundsStop,
|
|
11
14
|
type CameraStop,
|
|
12
15
|
type InitialViewState,
|
|
13
|
-
type CameraRef,
|
|
14
16
|
type TrackUserLocation,
|
|
15
17
|
type TrackUserLocationChangeEvent,
|
|
16
|
-
type CameraProps,
|
|
17
|
-
Camera,
|
|
18
18
|
} from "./components/camera/Camera";
|
|
19
19
|
|
|
20
20
|
export {
|
|
21
21
|
MapView,
|
|
22
|
+
type MapViewProps,
|
|
22
23
|
type MapViewRef,
|
|
23
24
|
type ViewState,
|
|
24
25
|
type ViewStateChangeEvent,
|
|
@@ -62,7 +63,8 @@ export { OfflineCreatePackOptions } from "./modules/offline/OfflineCreatePackOpt
|
|
|
62
63
|
export { SnapshotManager } from "./modules/snapshot/SnapshotManager";
|
|
63
64
|
export type { SnapshotInputOptions } from "./modules/snapshot/SnapshotOptions";
|
|
64
65
|
|
|
65
|
-
export type {
|
|
66
|
+
export type { LngLat } from "./types/LngLat";
|
|
67
|
+
export type { LngLatBounds } from "./types/LngLatBounds";
|
|
66
68
|
export type {
|
|
67
69
|
FillLayerStyle,
|
|
68
70
|
LineLayerStyle,
|
|
@@ -76,6 +78,8 @@ export type {
|
|
|
76
78
|
LightLayerStyle,
|
|
77
79
|
Expression,
|
|
78
80
|
} from "./types/MapLibreRNStyles";
|
|
81
|
+
export type { PixelPoint } from "./types/PixelPoint";
|
|
82
|
+
export type { PixelPointBounds } from "./types/PixelPointBounds";
|
|
79
83
|
export type { PressEvent, PressEventWithFeatures } from "./types/PressEvent";
|
|
80
84
|
export type { ViewPadding } from "./types/ViewPadding";
|
|
81
85
|
|
package/src/types/PressEvent.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
latitude: number;
|
|
1
|
+
import type { LngLat } from "./LngLat";
|
|
2
|
+
import type { PixelPoint } from "./PixelPoint";
|
|
5
3
|
|
|
4
|
+
export interface PressEvent {
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* Geographic coordinates of the touch event
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
lngLat: LngLat;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* Pixel point of the touch event within the elements' viewport
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
point: PixelPoint;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export interface PressEventWithFeatures extends PressEvent {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bounds.d.ts","sourceRoot":"","sources":["../../../../../src/types/Bounds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bounds.d.ts","sourceRoot":"","sources":["../../../../../src/types/Bounds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC"}
|
package/src/types/Bounds.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Bounds = [west: number, south: number, east: number, north: number];
|