@maplibre/maplibre-react-native 10.0.0-beta.13 → 10.0.0-beta.14
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/README.md +9 -11
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +37 -48
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +16 -9
- package/app.plugin.js +1 -1
- package/ios/MLRN/MLRNCamera.m +6 -7
- package/lib/commonjs/components/Camera.js +109 -60
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/MapView.js +6 -6
- package/lib/commonjs/modules/offline/OfflineManager.js +8 -8
- package/lib/commonjs/plugin/withMapLibre.js +149 -0
- package/lib/commonjs/plugin/withMapLibre.js.map +1 -0
- package/lib/module/components/Camera.js +111 -62
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/MapView.js +6 -6
- package/lib/module/modules/offline/OfflineManager.js +8 -8
- package/lib/module/plugin/withMapLibre.js +140 -0
- package/lib/module/plugin/withMapLibre.js.map +1 -0
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/OfflineManager.d.ts +8 -8
- package/{plugin/build → lib/typescript/commonjs/src/plugin}/withMapLibre.d.ts +1 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/OfflineManager.d.ts +8 -8
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts +13 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts.map +1 -0
- package/package.json +8 -10
- package/src/components/Camera.tsx +151 -73
- package/src/components/MapView.tsx +6 -6
- package/src/modules/offline/OfflineManager.ts +8 -8
- package/src/plugin/withMapLibre.ts +181 -0
- package/lib/typescript/commonjs/jest.config.d.ts +0 -2
- package/lib/typescript/commonjs/jest.config.d.ts.map +0 -1
- package/lib/typescript/module/jest.config.d.ts +0 -2
- package/lib/typescript/module/jest.config.d.ts.map +0 -1
- package/plugin/build/withMapLibre.js +0 -148
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[](https://maplibre.org)
|
|
2
2
|
|
|
3
3
|
# MapLibre React Native
|
|
4
|
+
|
|
4
5
|
[](LICENSE.md)
|
|
5
6
|
[](https://www.npmjs.com/package/@maplibre/maplibre-react-native)
|
|
6
|
-
[](https://github.com/maplibre/maplibre-react-native/actions/workflows/review.yml)
|
|
8
|
-
|
|
7
|
+
[](https://github.com/maplibre/maplibre-react-native/actions/workflows/review.yml)
|
|
9
8
|
|
|
10
|
-
_React Native library for creating maps
|
|
9
|
+
_React Native library for creating maps
|
|
10
|
+
with [MapLibre Native for Android & iOS](https://github.com/maplibre/maplibre-gl-native)._
|
|
11
11
|
|
|
12
12
|
This project originated as a fork of [rnmapbox](https://github.com/rnmapbox/maps), a community-maintained
|
|
13
13
|
React Native library for building maps with the Mapbox iOS and Android mobile SDKs. The original product
|
|
@@ -27,12 +27,10 @@ diverged, it has become necessary to separate the projects into specific wrapper
|
|
|
27
27
|
|
|
28
28
|
## Documentation
|
|
29
29
|
|
|
30
|
-
- [Getting Started](/docs/guides/setup/
|
|
30
|
+
- [Getting Started](/docs/guides/setup/Getting-Started)
|
|
31
31
|
- Installation
|
|
32
|
-
- React Native
|
|
33
|
-
- [Android](/docs/guides/setup/Android.md)
|
|
34
|
-
- [iOS](/docs/guides/setup/iOS.md)
|
|
35
32
|
- [Expo](/docs/guides/setup/Expo.md)
|
|
33
|
+
- [React Native](/docs/guides/setup/React-Native.md)
|
|
36
34
|
- Migrations
|
|
37
35
|
- [Migrating to v10](/docs/guides/migrations/v10.md)
|
|
38
36
|
|
|
@@ -71,13 +69,13 @@ diverged, it has become necessary to separate the projects into specific wrapper
|
|
|
71
69
|
|
|
72
70
|
### Misc
|
|
73
71
|
|
|
74
|
-
- [MLRNModule](/docs/guides/MLRNModule)
|
|
75
|
-
- [Custom HTTP Headers](/docs/guides/
|
|
72
|
+
- [MLRNModule](/docs/guides/MLRNModule.md)
|
|
73
|
+
- [Custom HTTP Headers](/docs/guides/Custom-HTTP-Headers.md)
|
|
76
74
|
- [Logger](/docs/guides/Logger.md)
|
|
77
75
|
|
|
78
76
|
## Contributing & Development
|
|
79
77
|
|
|
80
|
-
Read the [CONTRIBUTING
|
|
78
|
+
Read the [CONTRIBUTING](/CONTRIBUTING.md) guide in order to get familiar with how we do things around here and
|
|
81
79
|
set up your local development environment.
|
|
82
80
|
|
|
83
81
|
## Community
|
|
@@ -2,6 +2,7 @@ package org.maplibre.reactnative.components.camera;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.location.Location;
|
|
5
|
+
import android.util.Log;
|
|
5
6
|
|
|
6
7
|
import org.maplibre.android.camera.CameraPosition;
|
|
7
8
|
import org.maplibre.android.camera.CameraUpdate;
|
|
@@ -11,13 +12,9 @@ import org.maplibre.android.geometry.LatLngBounds;
|
|
|
11
12
|
import org.maplibre.android.geometry.VisibleRegion;
|
|
12
13
|
import org.maplibre.android.location.OnCameraTrackingChangedListener;
|
|
13
14
|
import org.maplibre.android.location.modes.CameraMode;
|
|
14
|
-
import org.maplibre.android.location.modes.RenderMode;
|
|
15
15
|
import org.maplibre.android.maps.MapLibreMap;
|
|
16
16
|
import org.maplibre.android.maps.Style;
|
|
17
|
-
|
|
18
|
-
import org.maplibre.android.location.LocationComponentOptions;
|
|
19
|
-
import org.maplibre.android.location.LocationComponentActivationOptions;
|
|
20
|
-
// import org.maplibre.android.plugins.locationlayer.LocationLayerPlugin;
|
|
17
|
+
|
|
21
18
|
import org.maplibre.reactnative.components.AbstractMapFeature;
|
|
22
19
|
import org.maplibre.reactnative.components.location.LocationComponentManager;
|
|
23
20
|
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
@@ -31,8 +28,6 @@ import org.maplibre.reactnative.location.UserTrackingMode;
|
|
|
31
28
|
import org.maplibre.reactnative.location.UserTrackingState;
|
|
32
29
|
import org.maplibre.reactnative.utils.GeoJSONUtils;
|
|
33
30
|
|
|
34
|
-
import org.maplibre.reactnative.R;
|
|
35
|
-
|
|
36
31
|
import org.maplibre.reactnative.events.constants.EventTypes;
|
|
37
32
|
|
|
38
33
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -87,12 +82,12 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
87
82
|
private LocationManager.OnUserLocationChange mLocationChangeListener = new LocationManager.OnUserLocationChange() {
|
|
88
83
|
@Override
|
|
89
84
|
public void onLocationChange(Location nextLocation) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
if (getMapboxMap() == null || mLocationComponentManager == null || !mLocationComponentManager.hasLocationComponent() || (!mFollowUserLocation)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
mUserLocation.setCurrentLocation(nextLocation);
|
|
90
|
+
sendUserLocationUpdateEvent(nextLocation);
|
|
96
91
|
}
|
|
97
92
|
};
|
|
98
93
|
|
|
@@ -236,12 +231,7 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
236
231
|
}
|
|
237
232
|
}
|
|
238
233
|
|
|
239
|
-
return new CameraPosition.Builder()
|
|
240
|
-
.target(center)
|
|
241
|
-
.bearing(getDirectionForUserLocationUpdate())
|
|
242
|
-
.tilt(mPitch)
|
|
243
|
-
.zoom(zoomLevel)
|
|
244
|
-
.build();
|
|
234
|
+
return new CameraPosition.Builder().target(center).bearing(getDirectionForUserLocationUpdate()).tilt(mPitch).zoom(zoomLevel).build();
|
|
245
235
|
}
|
|
246
236
|
|
|
247
237
|
private double getDirectionForUserLocationUpdate() {
|
|
@@ -260,7 +250,7 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
260
250
|
}
|
|
261
251
|
|
|
262
252
|
private void sendUserLocationUpdateEvent(Location location) {
|
|
263
|
-
if(location == null){
|
|
253
|
+
if (location == null) {
|
|
264
254
|
return;
|
|
265
255
|
}
|
|
266
256
|
IEvent event = new MapChangeEvent(this, EventTypes.USER_LOCATION_UPDATED, makeLocationChangePayload(location));
|
|
@@ -376,37 +366,38 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
376
366
|
}
|
|
377
367
|
|
|
378
368
|
mLocationComponentManager.update(style);
|
|
379
|
-
|
|
380
|
-
if (mFollowUserLocation) {
|
|
381
|
-
mLocationComponentManager.setCameraMode(UserTrackingMode.getCameraMode(mUserTrackingMode));
|
|
382
|
-
}
|
|
383
369
|
mLocationComponentManager.setFollowUserLocation(mFollowUserLocation);
|
|
384
370
|
|
|
385
371
|
if (mFollowUserLocation) {
|
|
386
372
|
mLocationComponentManager.setCameraMode(UserTrackingMode.getCameraMode(mUserTrackingMode));
|
|
387
373
|
mLocationComponentManager.addOnCameraTrackingChangedListener(new OnCameraTrackingChangedListener() {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
@Override public void onCameraTrackingDismissed() {
|
|
374
|
+
@Override
|
|
375
|
+
public void onCameraTrackingChanged(int currentMode) {
|
|
376
|
+
int userTrackingMode;
|
|
377
|
+
|
|
378
|
+
switch (currentMode) {
|
|
379
|
+
case CameraMode.NONE:
|
|
380
|
+
userTrackingMode = UserTrackingMode.NONE;
|
|
381
|
+
break;
|
|
382
|
+
case CameraMode.TRACKING:
|
|
383
|
+
userTrackingMode = UserTrackingMode.FOLLOW;
|
|
384
|
+
break;
|
|
385
|
+
case CameraMode.TRACKING_COMPASS:
|
|
386
|
+
userTrackingMode = UserTrackingMode.FollowWithHeading;
|
|
387
|
+
break;
|
|
388
|
+
case CameraMode.TRACKING_GPS:
|
|
389
|
+
userTrackingMode = UserTrackingMode.FollowWithCourse;
|
|
390
|
+
break;
|
|
391
|
+
default:
|
|
392
|
+
userTrackingMode = UserTrackingMode.NONE;
|
|
409
393
|
}
|
|
394
|
+
|
|
395
|
+
updateUserTrackingMode(userTrackingMode);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@Override
|
|
399
|
+
public void onCameraTrackingDismissed() {
|
|
400
|
+
}
|
|
410
401
|
});
|
|
411
402
|
} else {
|
|
412
403
|
mLocationComponentManager.setCameraMode(CameraMode.NONE);
|
|
@@ -429,10 +420,7 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
429
420
|
}
|
|
430
421
|
|
|
431
422
|
private CameraPosition buildCamera(CameraPosition previousPosition, boolean shouldUpdateTarget) {
|
|
432
|
-
CameraPosition.Builder builder = new CameraPosition.Builder(previousPosition)
|
|
433
|
-
.bearing(mHeading)
|
|
434
|
-
.tilt(mPitch)
|
|
435
|
-
.zoom(mZoomLevel);
|
|
423
|
+
CameraPosition.Builder builder = new CameraPosition.Builder(previousPosition).bearing(mHeading).tilt(mPitch).zoom(mZoomLevel);
|
|
436
424
|
|
|
437
425
|
if (shouldUpdateTarget) {
|
|
438
426
|
builder.target(GeoJSONUtils.toLatLng(mCenterCoordinate));
|
|
@@ -507,6 +495,7 @@ public class MLRNCamera extends AbstractMapFeature {
|
|
|
507
495
|
/**
|
|
508
496
|
* Create a payload of the location data per the web api geolocation spec
|
|
509
497
|
* https://dev.w3.org/geo/api/spec-source.html#position
|
|
498
|
+
*
|
|
510
499
|
* @return
|
|
511
500
|
*/
|
|
512
501
|
private WritableMap makeLocationChangePayload(Location location) {
|
|
@@ -46,6 +46,8 @@ public class LocationComponentManager {
|
|
|
46
46
|
|
|
47
47
|
private boolean mShowingUserLocation = false;
|
|
48
48
|
|
|
49
|
+
private OnCameraTrackingChangedListener mOnCameraTrackingChangedListener = null;
|
|
50
|
+
|
|
49
51
|
public void showUserLocation(boolean showUserLocation) {
|
|
50
52
|
mShowUserLocation = showUserLocation;
|
|
51
53
|
stateChanged();
|
|
@@ -68,16 +70,21 @@ public class LocationComponentManager {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
public void setPreferredFramesPerSecond(int preferredFramesPerSecond) {
|
|
71
|
-
|
|
73
|
+
if (mLocationComponent == null || preferredFramesPerSecond <= 0) {
|
|
72
74
|
return;
|
|
73
|
-
|
|
75
|
+
}
|
|
74
76
|
|
|
75
77
|
mLocationComponent.setMaxAnimationFps(preferredFramesPerSecond);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
|
|
79
80
|
public void addOnCameraTrackingChangedListener(OnCameraTrackingChangedListener onCameraTrackingChangedListener) {
|
|
80
|
-
|
|
81
|
+
if (mOnCameraTrackingChangedListener != null) {
|
|
82
|
+
mLocationComponent.removeOnCameraTrackingChangedListener(mOnCameraTrackingChangedListener);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
mOnCameraTrackingChangedListener = onCameraTrackingChangedListener;
|
|
86
|
+
|
|
87
|
+
mLocationComponent.addOnCameraTrackingChangedListener(mOnCameraTrackingChangedListener);
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
@SuppressLint("MissingPermission")
|
|
@@ -111,7 +118,7 @@ public class LocationComponentManager {
|
|
|
111
118
|
public void update(boolean displayUserLocation, @NonNull Style style) {
|
|
112
119
|
Integer tintColor = mMapView.getTintColor();
|
|
113
120
|
|
|
114
|
-
if (mLocationComponent == null || tintColor != null
|
|
121
|
+
if (mLocationComponent == null || tintColor != null) {
|
|
115
122
|
mLocationComponent = mMap.getLocationComponent();
|
|
116
123
|
|
|
117
124
|
LocationComponentActivationOptions locationComponentActivationOptions = LocationComponentActivationOptions
|
|
@@ -148,10 +155,10 @@ public class LocationComponentManager {
|
|
|
148
155
|
.accuracyAlpha(0.0f);
|
|
149
156
|
} else if (tintColor != null) {
|
|
150
157
|
builder = builder
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
.enableStaleState(false)
|
|
159
|
+
.bearingTintColor(tintColor)
|
|
160
|
+
.foregroundTintColor(tintColor)
|
|
161
|
+
.accuracyColor(tintColor);
|
|
155
162
|
}
|
|
156
163
|
return builder.build();
|
|
157
164
|
}
|
package/app.plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require("./plugin/
|
|
1
|
+
module.exports = require("./lib/commonjs/plugin/withMapLibre");
|
package/ios/MLRN/MLRNCamera.m
CHANGED
|
@@ -179,11 +179,6 @@
|
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
if (_map.userTrackingMode != [self _userTrackingMode]) {
|
|
183
|
-
_map.showsUserLocation = [self _userTrackingMode] != MLNUserTrackingModeNone;
|
|
184
|
-
_map.userTrackingMode = [self _userTrackingMode];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
182
|
MLNMapCamera *camera = _map.camera;
|
|
188
183
|
if (_followPitch != nil && [_followPitch floatValue] >= 0.0) {
|
|
189
184
|
camera.pitch = [_followPitch floatValue];
|
|
@@ -202,8 +197,12 @@
|
|
|
202
197
|
if (_followZoomLevel != nil && [_followZoomLevel doubleValue] >= 0.0) {
|
|
203
198
|
camera.altitude = [_map altitudeFromZoom:[_followZoomLevel doubleValue]];
|
|
204
199
|
}
|
|
205
|
-
|
|
206
|
-
[_map setCamera:camera animated:
|
|
200
|
+
|
|
201
|
+
[_map setCamera:camera animated:NO];
|
|
202
|
+
|
|
203
|
+
if (_map.userTrackingMode != [self _userTrackingMode]) {
|
|
204
|
+
[_map setUserTrackingMode:[self _userTrackingMode] animated:NO completionHandler:nil];
|
|
205
|
+
}
|
|
207
206
|
}
|
|
208
207
|
|
|
209
208
|
- (NSUInteger)_userTrackingMode
|
|
@@ -37,49 +37,52 @@ function makeNativeCameraStop(stop) {
|
|
|
37
37
|
if (!stop) {
|
|
38
38
|
return undefined;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const newNativeStop = {};
|
|
41
41
|
if (stop.animationDuration !== undefined) {
|
|
42
|
-
|
|
42
|
+
newNativeStop.duration = stop.animationDuration;
|
|
43
43
|
}
|
|
44
44
|
if (stop.animationMode !== undefined) {
|
|
45
|
-
|
|
45
|
+
newNativeStop.mode = getNativeCameraMode(stop.animationMode);
|
|
46
46
|
}
|
|
47
47
|
if (stop.centerCoordinate) {
|
|
48
|
-
|
|
48
|
+
newNativeStop.centerCoordinate = JSON.stringify((0, _helpers.point)(stop.centerCoordinate));
|
|
49
49
|
}
|
|
50
50
|
if (stop.heading !== undefined) {
|
|
51
|
-
|
|
51
|
+
newNativeStop.heading = stop.heading;
|
|
52
52
|
}
|
|
53
53
|
if (stop.pitch !== undefined) {
|
|
54
|
-
|
|
54
|
+
newNativeStop.pitch = stop.pitch;
|
|
55
55
|
}
|
|
56
56
|
if (stop.zoomLevel !== undefined) {
|
|
57
|
-
|
|
57
|
+
newNativeStop.zoom = stop.zoomLevel;
|
|
58
58
|
}
|
|
59
59
|
if (stop.bounds && stop.bounds.ne && stop.bounds.sw) {
|
|
60
60
|
const {
|
|
61
61
|
ne,
|
|
62
62
|
sw
|
|
63
63
|
} = stop.bounds;
|
|
64
|
-
|
|
64
|
+
newNativeStop.bounds = (0, _makeNativeBounds.makeNativeBounds)(ne, sw);
|
|
65
65
|
}
|
|
66
66
|
const paddingTop = stop.padding?.paddingTop ?? stop.bounds?.paddingTop;
|
|
67
67
|
if (paddingTop !== undefined) {
|
|
68
|
-
|
|
68
|
+
newNativeStop.paddingTop = paddingTop;
|
|
69
69
|
}
|
|
70
70
|
const paddingRight = stop.padding?.paddingRight ?? stop.bounds?.paddingRight;
|
|
71
71
|
if (paddingRight !== undefined) {
|
|
72
|
-
|
|
72
|
+
newNativeStop.paddingRight = paddingRight;
|
|
73
73
|
}
|
|
74
74
|
const paddingBottom = stop.padding?.paddingBottom ?? stop.bounds?.paddingBottom;
|
|
75
75
|
if (paddingBottom !== undefined) {
|
|
76
|
-
|
|
76
|
+
newNativeStop.paddingBottom = paddingBottom;
|
|
77
77
|
}
|
|
78
78
|
const paddingLeft = stop.padding?.paddingLeft ?? stop.bounds?.paddingLeft;
|
|
79
79
|
if (paddingLeft !== undefined) {
|
|
80
|
-
|
|
80
|
+
newNativeStop.paddingLeft = paddingLeft;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
if (newNativeStop.centerCoordinate && newNativeStop.bounds) {
|
|
83
|
+
throw new Error("Create a camera stop with bounds and centerCoordinate – this is not possible.");
|
|
84
|
+
}
|
|
85
|
+
return newNativeStop;
|
|
83
86
|
}
|
|
84
87
|
const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(({
|
|
85
88
|
animationMode,
|
|
@@ -101,40 +104,19 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
101
104
|
pitch,
|
|
102
105
|
zoomLevel
|
|
103
106
|
}, ref) => {
|
|
104
|
-
const
|
|
105
|
-
const nativeStop = (0, _react.useMemo)(() => {
|
|
106
|
-
return makeNativeCameraStop({
|
|
107
|
-
animationDuration,
|
|
108
|
-
animationMode,
|
|
109
|
-
bounds,
|
|
110
|
-
centerCoordinate,
|
|
111
|
-
heading,
|
|
112
|
-
padding,
|
|
113
|
-
pitch,
|
|
114
|
-
zoomLevel
|
|
115
|
-
});
|
|
116
|
-
}, [animationDuration, animationMode, bounds, centerCoordinate, heading, padding, pitch, zoomLevel]);
|
|
117
|
-
const nativeDefaultStop = (0, _react.useMemo)(() => {
|
|
118
|
-
return makeNativeCameraStop(defaultSettings);
|
|
119
|
-
}, [defaultSettings]);
|
|
120
|
-
const nativeMaxBounds = (0, _react.useMemo)(() => {
|
|
121
|
-
if (!maxBounds?.ne || !maxBounds?.sw) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
return (0, _makeNativeBounds.makeNativeBounds)(maxBounds.ne, maxBounds.sw);
|
|
125
|
-
}, [maxBounds]);
|
|
107
|
+
const nativeCameraRef = (0, _useNativeRef.useNativeRef)();
|
|
126
108
|
const setCamera = (config = {}) => {
|
|
127
109
|
if ("stops" in config) {
|
|
128
|
-
|
|
110
|
+
nativeCameraRef.current?.setNativeProps({
|
|
129
111
|
stop: {
|
|
130
112
|
stops: config.stops.map(stopItem => makeNativeCameraStop(stopItem)).filter(stopItem => !!stopItem)
|
|
131
113
|
}
|
|
132
114
|
});
|
|
133
115
|
} else {
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
stop
|
|
116
|
+
const stop = makeNativeCameraStop(config);
|
|
117
|
+
if (stop) {
|
|
118
|
+
nativeCameraRef.current?.setNativeProps({
|
|
119
|
+
stop
|
|
138
120
|
});
|
|
139
121
|
}
|
|
140
122
|
}
|
|
@@ -200,10 +182,10 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
200
182
|
* cameraRef.current?.fitBounds([lng, lat], [lng, lat], [verticalPadding, horizontalPadding], 1000)
|
|
201
183
|
* cameraRef.current?.fitBounds([lng, lat], [lng, lat], [top, right, bottom, left], 1000)
|
|
202
184
|
*
|
|
203
|
-
* @param {Array<
|
|
204
|
-
* @param {Array<
|
|
205
|
-
* @param {
|
|
206
|
-
* @param {
|
|
185
|
+
* @param {Array<number>} ne - North east coordinate of bound
|
|
186
|
+
* @param {Array<number>} sw - South west coordinate of bound
|
|
187
|
+
* @param {number|Array<number>|undefined} padding - Padding for the bounds
|
|
188
|
+
* @param {number=} animationDuration - Duration of camera animation
|
|
207
189
|
* @return {void}
|
|
208
190
|
*/
|
|
209
191
|
fitBounds,
|
|
@@ -214,8 +196,8 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
214
196
|
* cameraRef.current?.flyTo([lng, lat])
|
|
215
197
|
* cameraRef.current?.flyTo([lng, lat], 12000)
|
|
216
198
|
*
|
|
217
|
-
* @param {Array<
|
|
218
|
-
* @param {
|
|
199
|
+
* @param {Array<number>} coordinates - Coordinates that map camera will jump to
|
|
200
|
+
* @param {number=} animationDuration - Duration of camera animation
|
|
219
201
|
* @return {void}
|
|
220
202
|
*/
|
|
221
203
|
flyTo,
|
|
@@ -226,8 +208,8 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
226
208
|
* cameraRef.current?.moveTo([lng, lat], 200) // eases camera to new location based on duration
|
|
227
209
|
* cameraRef.current?.moveTo([lng, lat]) // snaps camera to new location without any easing
|
|
228
210
|
*
|
|
229
|
-
* @param {Array<
|
|
230
|
-
* @param {
|
|
211
|
+
* @param {Array<number>} coordinates - Coordinates that map camera will move too
|
|
212
|
+
* @param {number=} animationDuration - Duration of camera animation
|
|
231
213
|
* @return {void}
|
|
232
214
|
*/
|
|
233
215
|
moveTo,
|
|
@@ -238,8 +220,8 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
238
220
|
* cameraRef.current?.zoomTo(16)
|
|
239
221
|
* cameraRef.current?.zoomTo(16, 100)
|
|
240
222
|
*
|
|
241
|
-
* @param {
|
|
242
|
-
* @param {
|
|
223
|
+
* @param {number} zoomLevel - Zoom level that the map camera will animate too
|
|
224
|
+
* @param {number=} animationDuration - Duration of camera animation
|
|
243
225
|
* @return {void}
|
|
244
226
|
*/
|
|
245
227
|
zoomTo,
|
|
@@ -264,19 +246,86 @@ const Camera = exports.Camera = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _
|
|
|
264
246
|
*/
|
|
265
247
|
setCamera
|
|
266
248
|
}));
|
|
249
|
+
const followProps = (0, _react.useMemo)(() => {
|
|
250
|
+
return {
|
|
251
|
+
followUserMode,
|
|
252
|
+
followPitch: followPitch ?? pitch,
|
|
253
|
+
followHeading: followHeading ?? heading,
|
|
254
|
+
followZoomLevel: followZoomLevel ?? zoomLevel
|
|
255
|
+
};
|
|
256
|
+
}, [followUserMode, followPitch, pitch, followHeading, heading, followZoomLevel, zoomLevel]);
|
|
257
|
+
(0, _react.useEffect)(() => {
|
|
258
|
+
if (followUserLocation) {
|
|
259
|
+
if (_reactNative.Platform.OS === "android") {
|
|
260
|
+
nativeCameraRef.current?.setNativeProps({
|
|
261
|
+
...followProps,
|
|
262
|
+
followUserLocation
|
|
263
|
+
});
|
|
264
|
+
} else {
|
|
265
|
+
nativeCameraRef.current?.setNativeProps({
|
|
266
|
+
...followProps
|
|
267
|
+
});
|
|
268
|
+
nativeCameraRef.current?.setNativeProps({
|
|
269
|
+
followUserLocation
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
nativeCameraRef.current?.setNativeProps({
|
|
274
|
+
followUserLocation
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}, [followUserLocation, followProps]);
|
|
278
|
+
const nativeMaxBounds = (0, _react.useMemo)(() => {
|
|
279
|
+
if (!maxBounds?.ne || !maxBounds?.sw) {
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
return (0, _makeNativeBounds.makeNativeBounds)(maxBounds.ne, maxBounds.sw);
|
|
283
|
+
}, [maxBounds]);
|
|
284
|
+
(0, _react.useEffect)(() => {
|
|
285
|
+
if (!followUserLocation) {
|
|
286
|
+
nativeCameraRef.current?.setNativeProps({
|
|
287
|
+
maxBounds: nativeMaxBounds
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}, [followUserLocation, nativeMaxBounds]);
|
|
291
|
+
(0, _react.useEffect)(() => {
|
|
292
|
+
if (!followUserLocation) {
|
|
293
|
+
nativeCameraRef.current?.setNativeProps({
|
|
294
|
+
minZoomLevel
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}, [followUserLocation, minZoomLevel]);
|
|
298
|
+
(0, _react.useEffect)(() => {
|
|
299
|
+
if (!followUserLocation) {
|
|
300
|
+
nativeCameraRef.current?.setNativeProps({
|
|
301
|
+
maxZoomLevel
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}, [followUserLocation, maxZoomLevel]);
|
|
305
|
+
const nativeStop = (0, _react.useMemo)(() => {
|
|
306
|
+
return makeNativeCameraStop({
|
|
307
|
+
animationDuration,
|
|
308
|
+
animationMode,
|
|
309
|
+
bounds,
|
|
310
|
+
centerCoordinate,
|
|
311
|
+
heading,
|
|
312
|
+
padding,
|
|
313
|
+
pitch,
|
|
314
|
+
zoomLevel
|
|
315
|
+
});
|
|
316
|
+
}, [animationDuration, animationMode, bounds, centerCoordinate, heading, padding, pitch, zoomLevel]);
|
|
317
|
+
(0, _react.useEffect)(() => {
|
|
318
|
+
if (!followUserLocation) {
|
|
319
|
+
nativeCameraRef.current?.setNativeProps({
|
|
320
|
+
stop: nativeStop
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}, [followUserLocation, nativeStop]);
|
|
324
|
+
const [nativeDefaultStop] = (0, _react.useState)(makeNativeCameraStop(defaultSettings));
|
|
267
325
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNCamera, {
|
|
268
326
|
testID: "Camera",
|
|
269
|
-
ref:
|
|
270
|
-
stop: nativeStop,
|
|
327
|
+
ref: nativeCameraRef,
|
|
271
328
|
defaultStop: nativeDefaultStop,
|
|
272
|
-
maxBounds: nativeMaxBounds,
|
|
273
|
-
followUserLocation: followUserLocation,
|
|
274
|
-
followHeading: followHeading,
|
|
275
|
-
followPitch: followPitch,
|
|
276
|
-
followUserMode: followUserMode,
|
|
277
|
-
followZoomLevel: followZoomLevel,
|
|
278
|
-
maxZoomLevel: maxZoomLevel,
|
|
279
|
-
minZoomLevel: minZoomLevel,
|
|
280
329
|
onUserTrackingModeChange: onUserTrackingModeChange
|
|
281
330
|
});
|
|
282
331
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_helpers","require","_react","_reactNative","_MLRNModule","_useNativeRef","_makeNativeBounds","_jsxRuntime","NATIVE_MODULE_NAME","exports","UserTrackingMode","getNativeCameraMode","mode","CameraModes","Flight","None","Linear","Ease","makeNativeCameraStop","stop","undefined","
|
|
1
|
+
{"version":3,"names":["_helpers","require","_react","_reactNative","_MLRNModule","_useNativeRef","_makeNativeBounds","_jsxRuntime","NATIVE_MODULE_NAME","exports","UserTrackingMode","getNativeCameraMode","mode","CameraModes","Flight","None","Linear","Ease","makeNativeCameraStop","stop","undefined","newNativeStop","animationDuration","duration","animationMode","centerCoordinate","JSON","stringify","point","heading","pitch","zoomLevel","zoom","bounds","ne","sw","makeNativeBounds","paddingTop","padding","paddingRight","paddingBottom","paddingLeft","Error","Camera","memo","forwardRef","defaultSettings","followUserLocation","followHeading","followPitch","followUserMode","followZoomLevel","maxBounds","maxZoomLevel","minZoomLevel","onUserTrackingModeChange","ref","nativeCameraRef","useNativeRef","setCamera","config","current","setNativeProps","stops","map","stopItem","filter","fitBounds","_padding","Array","isArray","length","flyTo","coordinates","moveTo","zoomTo","useImperativeHandle","followProps","useMemo","useEffect","Platform","OS","nativeMaxBounds","nativeStop","nativeDefaultStop","useState","jsx","MLRNCamera","testID","defaultStop","requireNativeComponent"],"sourceRoot":"../../../src","sources":["components/Camera.tsx"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAIA,IAAAK,iBAAA,GAAAL,OAAA;AAA6D,IAAAM,WAAA,GAAAN,OAAA;AAEtD,MAAMO,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,YAAY;AAAC,IAEnCE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OA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AAC5C,SAAiB,EAAET,iBAAiB,GAAG,IAAI,KAAW;IACpEqC,SAAS,CAAC;MACR5B,SAAS;MACTT,iBAAiB;MACjBE,aAAa,EAAE;IACjB,CAAC,CAAC;EACJ,CAAC;EAED,IAAAoD,0BAAmB,EACjBpB,GAAG,EACH,OAAkB;IAChB;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACUW,SAAS;IACT;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACUK,KAAK;IACL;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACUE,MAAM;IACN;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACUC,MAAM;IACN;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACUhB;EACF,CAAC,CACH,CAAC;EAED,MAAMkB,WAAW,GAAG,IAAAC,cAAO,EAAC,MAAM;IAChC,OAAO;MACL5B,cAAc;MACdD,WAAW,EAAEA,WAAW,IAAInB,KAAK;MACjCkB,aAAa,EAAEA,aAAa,IAAInB,OAAO;MACvCsB,eAAe,EAAEA,eAAe,IAAIpB;IACtC,CAAC;EACH,CAAC,EAAE,CACDmB,cAAc,EACdD,WAAW,EACXnB,KAAK,EACLkB,aAAa,EACbnB,OAAO,EACPsB,eAAe,EACfpB,SAAS,CACV,CAAC;EAEF,IAAAgD,gBAAS,EAAC,MAAM;IACd,IAAIhC,kBAAkB,EAAE;MACtB,IAAIiC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;QAC7BxB,eAAe,CAACI,OAAO,EAAEC,cAAc,CAAC;UACtC,GAAGe,WAAW;UACd9B;QACF,CAAC,CAAC;MACJ,CAAC,MAAM;QACLU,eAAe,CAACI,OAAO,EAAEC,cAAc,CAAC;UACtC,GAAGe;QACL,CAAC,CAAC;QACFpB,eAAe,CAACI,O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gBAAgB;MAChBI,OAAO;MACPS,OAAO;MACPR,KAAK;MACLC;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CACDT,iBAAiB,EACjBE,aAAa,EACbS,MAAM,EACNR,gBAAgB,EAChBI,OAAO,EACPS,OAAO,EACPR,KAAK,EACLC,SAAS,CACV,CAAC;EAEF,IAAAgD,gBAAS,EAAC,MAAM;IACd,IAAI,CAAChC,kBAAkB,EAAE;MACvBU,eAAe,CAACI,OAAO,EAAEC,cAAc,CAAC;QACtC3C,IAAI,EAAEgE;MACR,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACpC,kBAAkB,EAAEoC,UAAU,CAAC,CAAC;EAEpC,MAAM,CAACC,iBAAiB,CAAC,GAAG,IAAAC,eAAQ,EAClCnE,oBAAoB,CAAC4B,eAAe,CACtC,CAAC;EAED,oBACE,IAAAvC,WAAA,CAAA+E,GAAA,EAACC,UAAU;IACTC,MAAM,EAAC,QAAQ;IACfhC,GAAG,EAAEC,eAAgB;IACrBgC,WAAW,EAAEL,iBAAkB;IAC/B7B,wBAAwB,EAAEA;EAAyB,CACpD,CAAC;AAEN,CACF,CACF,CAAC;AAED,MAAMgC,UAAU,GACd,IAAAG,mCAAsB,EAAoBlF,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -98,8 +98,8 @@ const MapView = exports.MapView = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0,
|
|
|
98
98
|
queryRenderedFeaturesInRect,
|
|
99
99
|
/**
|
|
100
100
|
* Takes snapshot of map with current tiles and returns a URI to the image
|
|
101
|
-
* @param {
|
|
102
|
-
* @return {
|
|
101
|
+
* @param {boolean} writeToDisk If true will create a temp file, otherwise it is in base64
|
|
102
|
+
* @return {string}
|
|
103
103
|
*/
|
|
104
104
|
takeSnap,
|
|
105
105
|
/**
|
|
@@ -108,7 +108,7 @@ const MapView = exports.MapView = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0,
|
|
|
108
108
|
* @example
|
|
109
109
|
* const zoom = await this._map.getZoom();
|
|
110
110
|
*
|
|
111
|
-
* @return {
|
|
111
|
+
* @return {number}
|
|
112
112
|
*/
|
|
113
113
|
getZoom,
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ const MapView = exports.MapView = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0,
|
|
|
117
117
|
* @example
|
|
118
118
|
* const center = await this._map.getCenter();
|
|
119
119
|
*
|
|
120
|
-
* @return {Array<
|
|
120
|
+
* @return {Array<number>} Coordinates
|
|
121
121
|
*/
|
|
122
122
|
getCenter,
|
|
123
123
|
/**
|
|
@@ -127,8 +127,8 @@ const MapView = exports.MapView = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0,
|
|
|
127
127
|
* await this._map.setSourceVisibility(false, 'composite', 'building')
|
|
128
128
|
*
|
|
129
129
|
* @param {boolean} visible - Visibility of the layers
|
|
130
|
-
* @param {
|
|
131
|
-
* @param {
|
|
130
|
+
* @param {string} sourceId - Identifier of the target source (e.g. 'composite')
|
|
131
|
+
* @param {string=} sourceLayerId - Identifier of the target source-layer (e.g. 'building')
|
|
132
132
|
*/
|
|
133
133
|
setSourceVisibility,
|
|
134
134
|
/**
|