@maplibre/maplibre-react-native 11.0.0-alpha.16 → 11.0.0-alpha.17
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/MLRNCameraManager.kt +3 -5
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.kt +154 -0
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.kt +70 -0
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.kt +50 -0
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLocationModule.kt +20 -4
- package/ios/components/camera/MLRNCameraComponentView.h +0 -8
- package/ios/components/map-view/MLRNMapView.m +1 -1
- package/ios/components/map-view/MLRNMapViewComponentView.h +0 -5
- package/ios/components/user-location/MLRNNativeUserLocation.h +1 -1
- package/ios/components/user-location/MLRNNativeUserLocation.m +6 -5
- package/ios/components/user-location/MLRNNativeUserLocationComponentView.h +10 -0
- package/ios/components/user-location/MLRNNativeUserLocationComponentView.mm +51 -0
- package/ios/modules/location/MLRNLocation.m +17 -14
- package/ios/modules/logging/MLRNLogging.h +0 -5
- package/lib/commonjs/components/annotations/Annotation.js +2 -1
- package/lib/commonjs/components/annotations/Annotation.js.map +1 -1
- package/lib/commonjs/components/sources/ShapeSource.js +1 -0
- package/lib/commonjs/components/sources/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/user-location/NativeUserLocation.js +3 -4
- package/lib/commonjs/components/user-location/NativeUserLocation.js.map +1 -1
- package/lib/commonjs/components/user-location/UserLocation.js +22 -132
- package/lib/commonjs/components/user-location/UserLocation.js.map +1 -1
- package/lib/commonjs/components/user-location/UserLocationNativeComponent.ts +19 -0
- package/lib/commonjs/components/user-location/UserLocationPuck.js +34 -22
- package/lib/commonjs/components/user-location/UserLocationPuck.js.map +1 -1
- package/lib/commonjs/components/user-location/UserLocationPuckHeading.js +3 -2
- package/lib/commonjs/components/user-location/UserLocationPuckHeading.js.map +1 -1
- package/lib/commonjs/hooks/useCurrentPosition.js +34 -0
- package/lib/commonjs/hooks/useCurrentPosition.js.map +1 -0
- package/lib/commonjs/index.js +12 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/animated/Animated.js +1 -7
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/module/components/annotations/Annotation.js +3 -2
- package/lib/module/components/annotations/Annotation.js.map +1 -1
- package/lib/module/components/sources/ShapeSource.js +1 -0
- package/lib/module/components/sources/ShapeSource.js.map +1 -1
- package/lib/module/components/user-location/NativeUserLocation.js +2 -4
- package/lib/module/components/user-location/NativeUserLocation.js.map +1 -1
- package/lib/module/components/user-location/UserLocation.js +22 -132
- package/lib/module/components/user-location/UserLocation.js.map +1 -1
- package/lib/module/components/user-location/UserLocationNativeComponent.ts +19 -0
- package/lib/module/components/user-location/UserLocationPuck.js +34 -22
- package/lib/module/components/user-location/UserLocationPuck.js.map +1 -1
- package/lib/module/components/user-location/UserLocationPuckHeading.js +3 -2
- package/lib/module/components/user-location/UserLocationPuckHeading.js.map +1 -1
- package/lib/module/hooks/useCurrentPosition.js +30 -0
- package/lib/module/hooks/useCurrentPosition.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/animated/Animated.js +0 -6
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/typescript/commonjs/src/components/annotations/Annotation.d.ts +3 -2
- package/lib/typescript/commonjs/src/components/annotations/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/sources/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-location/NativeUserLocation.d.ts +12 -13
- package/lib/typescript/commonjs/src/components/user-location/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-location/UserLocation.d.ts +13 -53
- package/lib/typescript/commonjs/src/components/user-location/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-location/UserLocationNativeComponent.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/user-location/UserLocationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/user-location/UserLocationPuck.d.ts +2 -1
- package/lib/typescript/commonjs/src/components/user-location/UserLocationPuck.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-location/UserLocationPuckHeading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useCurrentPosition.d.ts +18 -0
- package/lib/typescript/commonjs/src/hooks/useCurrentPosition.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +3 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts +3 -3
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/location/NativeLocationModule.d.ts +3 -3
- package/lib/typescript/commonjs/src/modules/location/NativeLocationModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -13
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/module/src/components/annotations/Annotation.d.ts +3 -2
- package/lib/typescript/module/src/components/annotations/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/sources/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-location/NativeUserLocation.d.ts +12 -13
- package/lib/typescript/module/src/components/user-location/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-location/UserLocation.d.ts +13 -53
- package/lib/typescript/module/src/components/user-location/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-location/UserLocationNativeComponent.d.ts +8 -0
- package/lib/typescript/module/src/components/user-location/UserLocationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/user-location/UserLocationPuck.d.ts +2 -1
- package/lib/typescript/module/src/components/user-location/UserLocationPuck.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-location/UserLocationPuckHeading.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useCurrentPosition.d.ts +18 -0
- package/lib/typescript/module/src/hooks/useCurrentPosition.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +3 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts +3 -3
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/location/NativeLocationModule.d.ts +3 -3
- package/lib/typescript/module/src/modules/location/NativeLocationModule.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -13
- package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/annotations/Annotation.tsx +7 -5
- package/src/components/sources/ShapeSource.tsx +1 -0
- package/src/components/user-location/NativeUserLocation.tsx +15 -19
- package/src/components/user-location/UserLocation.tsx +65 -249
- package/src/components/user-location/UserLocationNativeComponent.ts +19 -0
- package/src/components/user-location/UserLocationPuck.tsx +47 -28
- package/src/components/user-location/UserLocationPuckHeading.tsx +2 -1
- package/src/hooks/useCurrentPosition.ts +53 -0
- package/src/index.ts +5 -6
- package/src/modules/location/LocationManager.ts +3 -3
- package/src/modules/location/NativeLocationModule.ts +3 -3
- package/src/utils/animated/Animated.ts +1 -28
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +0 -165
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.java +0 -76
- package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.java +0 -40
- package/ios/components/user-location/MLRNNativeUserLocationManager.h +0 -5
- package/ios/components/user-location/MLRNNativeUserLocationManager.m +0 -21
- package/lib/commonjs/modules/location/requestAndroidLocationPermissions.js +0 -14
- package/lib/commonjs/modules/location/requestAndroidLocationPermissions.js.map +0 -1
- package/lib/module/modules/location/requestAndroidLocationPermissions.js +0 -11
- package/lib/module/modules/location/requestAndroidLocationPermissions.js.map +0 -1
- package/lib/typescript/commonjs/src/modules/location/requestAndroidLocationPermissions.d.ts +0 -5
- package/lib/typescript/commonjs/src/modules/location/requestAndroidLocationPermissions.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/location/requestAndroidLocationPermissions.d.ts +0 -5
- package/lib/typescript/module/src/modules/location/requestAndroidLocationPermissions.d.ts.map +0 -1
- package/src/modules/location/requestAndroidLocationPermissions.ts +0 -8
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
package org.maplibre.reactnative.components.location;
|
|
2
|
-
|
|
3
|
-
import android.annotation.SuppressLint;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
|
|
6
|
-
import org.maplibre.android.location.LocationComponent;
|
|
7
|
-
import org.maplibre.android.location.LocationComponentActivationOptions;
|
|
8
|
-
import org.maplibre.android.location.LocationComponentOptions;
|
|
9
|
-
import org.maplibre.android.location.OnCameraTrackingChangedListener;
|
|
10
|
-
import org.maplibre.android.location.modes.CameraMode;
|
|
11
|
-
import org.maplibre.android.location.modes.RenderMode;
|
|
12
|
-
import org.maplibre.android.maps.MapLibreMap;
|
|
13
|
-
import org.maplibre.android.maps.Style;
|
|
14
|
-
import org.maplibre.reactnative.R;
|
|
15
|
-
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
16
|
-
import org.maplibre.reactnative.location.LocationManager;
|
|
17
|
-
|
|
18
|
-
import androidx.annotation.NonNull;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The LocationComponent on android implements both location tracking and display of user's current location.
|
|
22
|
-
* LocationComponentManager attempts to separate that, so that Camera can ask for location tracking independent of display of user current location.
|
|
23
|
-
* And NativeUserLocation can ask for display of user's current location - independent of Camera's user tracking.
|
|
24
|
-
*/
|
|
25
|
-
public class LocationComponentManager {
|
|
26
|
-
private MLRNMapView mMapView = null;
|
|
27
|
-
private MapLibreMap mMap = null;
|
|
28
|
-
|
|
29
|
-
private LocationManager mLocationManager = null;
|
|
30
|
-
private LocationComponent mLocationComponent = null;
|
|
31
|
-
private Context mContext = null;
|
|
32
|
-
|
|
33
|
-
private @RenderMode.Mode int mRenderMode = RenderMode.COMPASS;
|
|
34
|
-
|
|
35
|
-
public LocationComponentManager(MLRNMapView mlrnMapView, Context context) {
|
|
36
|
-
mMapView = mlrnMapView;
|
|
37
|
-
mMap = mMapView.getMapLibreMap();
|
|
38
|
-
mContext = context;
|
|
39
|
-
|
|
40
|
-
mLocationManager = LocationManager.getInstance(context);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private boolean mShowUserLocation = false;
|
|
44
|
-
|
|
45
|
-
private boolean mFollowUserLocation = false;
|
|
46
|
-
|
|
47
|
-
private boolean mShowingUserLocation = false;
|
|
48
|
-
|
|
49
|
-
private OnCameraTrackingChangedListener mOnCameraTrackingChangedListener = null;
|
|
50
|
-
|
|
51
|
-
public void showUserLocation(boolean showUserLocation) {
|
|
52
|
-
mShowUserLocation = showUserLocation;
|
|
53
|
-
stateChanged();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public void setFollowUserLocation(boolean followUserLocation) {
|
|
57
|
-
mFollowUserLocation = followUserLocation;
|
|
58
|
-
stateChanged();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public void setCameraMode(@CameraMode.Mode int cameraMode) {
|
|
62
|
-
mLocationComponent.setCameraMode(cameraMode);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public void setRenderMode(@RenderMode.Mode int renderMode) {
|
|
66
|
-
mRenderMode = renderMode;
|
|
67
|
-
if (mShowingUserLocation) {
|
|
68
|
-
mLocationComponent.setRenderMode(renderMode);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public void setPreferredFramesPerSecond(int preferredFramesPerSecond) {
|
|
73
|
-
if (mLocationComponent == null || preferredFramesPerSecond <= 0) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
mLocationComponent.setMaxAnimationFps(preferredFramesPerSecond);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public void addOnCameraTrackingChangedListener(OnCameraTrackingChangedListener onCameraTrackingChangedListener) {
|
|
81
|
-
if (mOnCameraTrackingChangedListener != null) {
|
|
82
|
-
mLocationComponent.removeOnCameraTrackingChangedListener(mOnCameraTrackingChangedListener);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
mOnCameraTrackingChangedListener = onCameraTrackingChangedListener;
|
|
86
|
-
|
|
87
|
-
mLocationComponent.addOnCameraTrackingChangedListener(mOnCameraTrackingChangedListener);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@SuppressLint("MissingPermission")
|
|
91
|
-
private void stateChanged() {
|
|
92
|
-
mLocationComponent.setLocationComponentEnabled((mFollowUserLocation || mShowUserLocation));
|
|
93
|
-
|
|
94
|
-
if (mShowingUserLocation != mShowUserLocation) {
|
|
95
|
-
updateShowUserLocation(mShowUserLocation);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (mFollowUserLocation) {
|
|
99
|
-
if (!mShowUserLocation) {
|
|
100
|
-
mLocationComponent.setRenderMode(RenderMode.GPS);
|
|
101
|
-
} else {
|
|
102
|
-
mLocationComponent.setRenderMode(mRenderMode);
|
|
103
|
-
}
|
|
104
|
-
mLocationComponent.onStart();
|
|
105
|
-
} else {
|
|
106
|
-
mLocationComponent.setCameraMode(CameraMode.NONE);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public boolean hasLocationComponent() {
|
|
111
|
-
return (mLocationComponent != null);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public void update(@NonNull Style style) {
|
|
115
|
-
update(mShowUserLocation, style);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public void update(boolean displayUserLocation, @NonNull Style style) {
|
|
119
|
-
Integer tintColor = mMapView.getTintColor();
|
|
120
|
-
|
|
121
|
-
if (mLocationComponent == null || tintColor != null) {
|
|
122
|
-
mLocationComponent = mMap.getLocationComponent();
|
|
123
|
-
|
|
124
|
-
LocationComponentActivationOptions locationComponentActivationOptions = LocationComponentActivationOptions
|
|
125
|
-
.builder(mContext, style)
|
|
126
|
-
.locationComponentOptions(options(displayUserLocation))
|
|
127
|
-
.build();
|
|
128
|
-
mLocationComponent.activateLocationComponent(locationComponentActivationOptions);
|
|
129
|
-
mLocationComponent.setLocationEngine(mLocationManager.getEngine());
|
|
130
|
-
mShowingUserLocation = displayUserLocation;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
updateShowUserLocation(displayUserLocation);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private void updateShowUserLocation(boolean displayUserLocation) {
|
|
137
|
-
if (mShowingUserLocation != displayUserLocation) {
|
|
138
|
-
mLocationComponent.applyStyle(options(displayUserLocation));
|
|
139
|
-
mShowingUserLocation = displayUserLocation;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
LocationComponentOptions options(boolean displayUserLocation) {
|
|
144
|
-
LocationComponentOptions.Builder builder = LocationComponentOptions.builder(mContext);
|
|
145
|
-
Integer tintColor = mMapView.getTintColor();
|
|
146
|
-
if (!displayUserLocation) {
|
|
147
|
-
builder = builder
|
|
148
|
-
.padding(mMap.getPadding())
|
|
149
|
-
.backgroundDrawable(R.drawable.empty)
|
|
150
|
-
.backgroundDrawableStale(R.drawable.empty)
|
|
151
|
-
.bearingDrawable(R.drawable.empty)
|
|
152
|
-
.foregroundDrawable(R.drawable.empty)
|
|
153
|
-
.foregroundDrawableStale(R.drawable.empty)
|
|
154
|
-
.gpsDrawable(R.drawable.empty)
|
|
155
|
-
.accuracyAlpha(0.0f);
|
|
156
|
-
} else if (tintColor != null) {
|
|
157
|
-
builder = builder
|
|
158
|
-
.enableStaleState(false)
|
|
159
|
-
.bearingTintColor(tintColor)
|
|
160
|
-
.foregroundTintColor(tintColor)
|
|
161
|
-
.accuracyColor(tintColor);
|
|
162
|
-
}
|
|
163
|
-
return builder.build();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
package org.maplibre.reactnative.components.location;
|
|
2
|
-
|
|
3
|
-
import android.annotation.SuppressLint;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
import androidx.annotation.NonNull;
|
|
6
|
-
|
|
7
|
-
import org.maplibre.android.location.permissions.PermissionsManager;
|
|
8
|
-
import org.maplibre.android.location.modes.RenderMode;
|
|
9
|
-
import org.maplibre.android.maps.MapLibreMap;
|
|
10
|
-
import org.maplibre.android.maps.OnMapReadyCallback;
|
|
11
|
-
import org.maplibre.android.maps.Style;
|
|
12
|
-
import org.maplibre.reactnative.components.AbstractMapFeature;
|
|
13
|
-
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
14
|
-
|
|
15
|
-
public class MLRNNativeUserLocation extends AbstractMapFeature implements OnMapReadyCallback, Style.OnStyleLoaded {
|
|
16
|
-
private boolean mEnabled = true;
|
|
17
|
-
private MapLibreMap mMap;
|
|
18
|
-
private MLRNMapView mMapView;
|
|
19
|
-
private @RenderMode.Mode int mRenderMode = RenderMode.COMPASS;
|
|
20
|
-
private int mPreferredFramesPerSecond;
|
|
21
|
-
|
|
22
|
-
public MLRNNativeUserLocation(Context context) {
|
|
23
|
-
super(context);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Override
|
|
27
|
-
public void addToMap(MLRNMapView mapView) {
|
|
28
|
-
mEnabled = true;
|
|
29
|
-
mMapView = mapView;
|
|
30
|
-
mapView.getMapAsync(this);
|
|
31
|
-
setRenderMode(mRenderMode);
|
|
32
|
-
setPreferredFramesPerSecond(mPreferredFramesPerSecond);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Override
|
|
36
|
-
public void removeFromMap(MLRNMapView mapView) {
|
|
37
|
-
mEnabled = false;
|
|
38
|
-
if (mMap != null) mMap.getStyle(this);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@SuppressLint("MissingPermission")
|
|
42
|
-
@Override
|
|
43
|
-
public void onMapReady(@NonNull MapLibreMap mapboxMap) {
|
|
44
|
-
mMap = mapboxMap;
|
|
45
|
-
mapboxMap.getStyle(this);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@SuppressLint("MissingPermission")
|
|
49
|
-
@Override
|
|
50
|
-
public void onStyleLoaded(@NonNull Style style) {
|
|
51
|
-
Context context = getContext();
|
|
52
|
-
if (!PermissionsManager.areLocationPermissionsGranted(context)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
LocationComponentManager locationComponent = mMapView.getLocationComponentManager();
|
|
57
|
-
locationComponent.update(style);
|
|
58
|
-
locationComponent.showUserLocation(mEnabled);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public void setRenderMode(@RenderMode.Mode int renderMode) {
|
|
62
|
-
mRenderMode = renderMode;
|
|
63
|
-
if (mMapView != null) {
|
|
64
|
-
LocationComponentManager locationComponent = mMapView.getLocationComponentManager();
|
|
65
|
-
locationComponent.setRenderMode(renderMode);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public void setPreferredFramesPerSecond(int framesPerSecond) {
|
|
70
|
-
mPreferredFramesPerSecond = framesPerSecond;
|
|
71
|
-
if (mMapView != null) {
|
|
72
|
-
LocationComponentManager locationComponent = mMapView.getLocationComponentManager();
|
|
73
|
-
locationComponent.setPreferredFramesPerSecond(framesPerSecond);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
package org.maplibre.reactnative.components.location;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
4
|
-
import com.facebook.react.uimanager.ViewGroupManager;
|
|
5
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
6
|
-
import org.maplibre.android.location.modes.RenderMode;
|
|
7
|
-
|
|
8
|
-
import javax.annotation.Nonnull;
|
|
9
|
-
|
|
10
|
-
public class MLRNNativeUserLocationManager extends ViewGroupManager<MLRNNativeUserLocation> {
|
|
11
|
-
public static final String REACT_CLASS = "MLRNNativeUserLocation";
|
|
12
|
-
|
|
13
|
-
@Nonnull
|
|
14
|
-
@Override
|
|
15
|
-
public String getName() {
|
|
16
|
-
return REACT_CLASS;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@ReactProp(name="androidRenderMode")
|
|
20
|
-
public void setAndroidRenderMode(MLRNNativeUserLocation userLocation, String mode) {
|
|
21
|
-
if ("compass".equalsIgnoreCase(mode)) {
|
|
22
|
-
userLocation.setRenderMode(RenderMode.COMPASS);
|
|
23
|
-
} else if ("gps".equalsIgnoreCase(mode)) {
|
|
24
|
-
userLocation.setRenderMode(RenderMode.GPS);
|
|
25
|
-
} else {
|
|
26
|
-
userLocation.setRenderMode(RenderMode.NORMAL);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@ReactProp(name="androidPreferredFramesPerSecond")
|
|
31
|
-
public void setPreferredFramesPerSecond(MLRNNativeUserLocation userLocation, int preferredFramesPerSecond) {
|
|
32
|
-
userLocation.setPreferredFramesPerSecond(preferredFramesPerSecond);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Nonnull
|
|
36
|
-
@Override
|
|
37
|
-
protected MLRNNativeUserLocation createViewInstance(@Nonnull ThemedReactContext reactContext) {
|
|
38
|
-
return new MLRNNativeUserLocation(reactContext);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#import "MLRNNativeUserLocationManager.h"
|
|
2
|
-
#import "MLRNNativeUserLocation.h"
|
|
3
|
-
|
|
4
|
-
@implementation MLRNNativeUserLocationManager
|
|
5
|
-
|
|
6
|
-
RCT_EXPORT_MODULE(MLRNNativeUserLocation)
|
|
7
|
-
RCT_EXPORT_VIEW_PROPERTY(iosShowsUserHeadingIndicator, BOOL)
|
|
8
|
-
|
|
9
|
-
#pragma - View Properties
|
|
10
|
-
|
|
11
|
-
#pragma Methods
|
|
12
|
-
|
|
13
|
-
- (BOOL)requiresMainQueueSetup {
|
|
14
|
-
return YES;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
- (UIView *)view {
|
|
18
|
-
return [[MLRNNativeUserLocation alloc] init];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.requestAndroidLocationPermissions = requestAndroidLocationPermissions;
|
|
7
|
-
var _LocationManager = require("./LocationManager.js");
|
|
8
|
-
/**
|
|
9
|
-
* @deprected Use `LocationManager.requestAndroidPermissions` instead
|
|
10
|
-
*/
|
|
11
|
-
async function requestAndroidLocationPermissions() {
|
|
12
|
-
return _LocationManager.LocationManager.requestAndroidPermissions();
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=requestAndroidLocationPermissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_LocationManager","require","requestAndroidLocationPermissions","LocationManager","requestAndroidPermissions"],"sourceRoot":"../../../../src","sources":["modules/location/requestAndroidLocationPermissions.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,eAAeC,iCAAiCA,CAAA,EAAqB;EAC1E,OAAOC,gCAAe,CAACC,yBAAyB,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { LocationManager } from "./LocationManager.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @deprected Use `LocationManager.requestAndroidPermissions` instead
|
|
7
|
-
*/
|
|
8
|
-
export async function requestAndroidLocationPermissions() {
|
|
9
|
-
return LocationManager.requestAndroidPermissions();
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=requestAndroidLocationPermissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LocationManager","requestAndroidLocationPermissions","requestAndroidPermissions"],"sourceRoot":"../../../../src","sources":["modules/location/requestAndroidLocationPermissions.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,sBAAmB;;AAEnD;AACA;AACA;AACA,OAAO,eAAeC,iCAAiCA,CAAA,EAAqB;EAC1E,OAAOD,eAAe,CAACE,yBAAyB,CAAC,CAAC;AACpD","ignoreList":[]}
|
package/lib/typescript/commonjs/src/modules/location/requestAndroidLocationPermissions.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestAndroidLocationPermissions.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/location/requestAndroidLocationPermissions.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,OAAO,CAAC,CAE1E"}
|
package/lib/typescript/module/src/modules/location/requestAndroidLocationPermissions.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestAndroidLocationPermissions.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/location/requestAndroidLocationPermissions.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,OAAO,CAAC,CAE1E"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LocationManager } from "./LocationManager";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprected Use `LocationManager.requestAndroidPermissions` instead
|
|
5
|
-
*/
|
|
6
|
-
export async function requestAndroidLocationPermissions(): Promise<boolean> {
|
|
7
|
-
return LocationManager.requestAndroidPermissions();
|
|
8
|
-
}
|