@maplibre/maplibre-react-native 11.0.0-alpha.15 → 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.
Files changed (124) hide show
  1. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +3 -5
  2. package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.kt +154 -0
  3. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.kt +70 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.kt +50 -0
  5. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLocationModule.kt +20 -4
  6. package/ios/components/camera/MLRNCameraComponentView.h +0 -8
  7. package/ios/components/map-view/MLRNMapView.m +1 -1
  8. package/ios/components/map-view/MLRNMapViewComponentView.h +0 -5
  9. package/ios/components/map-view/MLRNMapViewModule.mm +11 -6
  10. package/ios/components/user-location/MLRNNativeUserLocation.h +1 -1
  11. package/ios/components/user-location/MLRNNativeUserLocation.m +6 -5
  12. package/ios/components/user-location/MLRNNativeUserLocationComponentView.h +10 -0
  13. package/ios/components/user-location/MLRNNativeUserLocationComponentView.mm +51 -0
  14. package/ios/modules/location/MLRNLocation.m +17 -14
  15. package/ios/modules/logging/MLRNLogging.h +0 -5
  16. package/lib/commonjs/components/annotations/Annotation.js +2 -1
  17. package/lib/commonjs/components/annotations/Annotation.js.map +1 -1
  18. package/lib/commonjs/components/sources/ShapeSource.js +1 -0
  19. package/lib/commonjs/components/sources/ShapeSource.js.map +1 -1
  20. package/lib/commonjs/components/user-location/NativeUserLocation.js +3 -4
  21. package/lib/commonjs/components/user-location/NativeUserLocation.js.map +1 -1
  22. package/lib/commonjs/components/user-location/UserLocation.js +22 -132
  23. package/lib/commonjs/components/user-location/UserLocation.js.map +1 -1
  24. package/lib/commonjs/components/user-location/UserLocationNativeComponent.ts +19 -0
  25. package/lib/commonjs/components/user-location/UserLocationPuck.js +34 -22
  26. package/lib/commonjs/components/user-location/UserLocationPuck.js.map +1 -1
  27. package/lib/commonjs/components/user-location/UserLocationPuckHeading.js +3 -2
  28. package/lib/commonjs/components/user-location/UserLocationPuckHeading.js.map +1 -1
  29. package/lib/commonjs/hooks/useCurrentPosition.js +34 -0
  30. package/lib/commonjs/hooks/useCurrentPosition.js.map +1 -0
  31. package/lib/commonjs/index.js +12 -11
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/utils/animated/Animated.js +1 -7
  34. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  35. package/lib/module/components/annotations/Annotation.js +3 -2
  36. package/lib/module/components/annotations/Annotation.js.map +1 -1
  37. package/lib/module/components/sources/ShapeSource.js +1 -0
  38. package/lib/module/components/sources/ShapeSource.js.map +1 -1
  39. package/lib/module/components/user-location/NativeUserLocation.js +2 -4
  40. package/lib/module/components/user-location/NativeUserLocation.js.map +1 -1
  41. package/lib/module/components/user-location/UserLocation.js +22 -132
  42. package/lib/module/components/user-location/UserLocation.js.map +1 -1
  43. package/lib/module/components/user-location/UserLocationNativeComponent.ts +19 -0
  44. package/lib/module/components/user-location/UserLocationPuck.js +34 -22
  45. package/lib/module/components/user-location/UserLocationPuck.js.map +1 -1
  46. package/lib/module/components/user-location/UserLocationPuckHeading.js +3 -2
  47. package/lib/module/components/user-location/UserLocationPuckHeading.js.map +1 -1
  48. package/lib/module/hooks/useCurrentPosition.js +30 -0
  49. package/lib/module/hooks/useCurrentPosition.js.map +1 -0
  50. package/lib/module/index.js +3 -2
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/utils/animated/Animated.js +0 -6
  53. package/lib/module/utils/animated/Animated.js.map +1 -1
  54. package/lib/typescript/commonjs/src/components/annotations/Annotation.d.ts +3 -2
  55. package/lib/typescript/commonjs/src/components/annotations/Annotation.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/src/components/sources/ShapeSource.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/components/user-location/NativeUserLocation.d.ts +12 -13
  58. package/lib/typescript/commonjs/src/components/user-location/NativeUserLocation.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/src/components/user-location/UserLocation.d.ts +13 -53
  60. package/lib/typescript/commonjs/src/components/user-location/UserLocation.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/src/components/user-location/UserLocationNativeComponent.d.ts +8 -0
  62. package/lib/typescript/commonjs/src/components/user-location/UserLocationNativeComponent.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/src/components/user-location/UserLocationPuck.d.ts +2 -1
  64. package/lib/typescript/commonjs/src/components/user-location/UserLocationPuck.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/components/user-location/UserLocationPuckHeading.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/src/hooks/useCurrentPosition.d.ts +18 -0
  67. package/lib/typescript/commonjs/src/hooks/useCurrentPosition.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/src/index.d.ts +3 -3
  69. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts +3 -3
  71. package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/src/modules/location/NativeLocationModule.d.ts +3 -3
  73. package/lib/typescript/commonjs/src/modules/location/NativeLocationModule.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -13
  75. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
  76. package/lib/typescript/module/src/components/annotations/Annotation.d.ts +3 -2
  77. package/lib/typescript/module/src/components/annotations/Annotation.d.ts.map +1 -1
  78. package/lib/typescript/module/src/components/sources/ShapeSource.d.ts.map +1 -1
  79. package/lib/typescript/module/src/components/user-location/NativeUserLocation.d.ts +12 -13
  80. package/lib/typescript/module/src/components/user-location/NativeUserLocation.d.ts.map +1 -1
  81. package/lib/typescript/module/src/components/user-location/UserLocation.d.ts +13 -53
  82. package/lib/typescript/module/src/components/user-location/UserLocation.d.ts.map +1 -1
  83. package/lib/typescript/module/src/components/user-location/UserLocationNativeComponent.d.ts +8 -0
  84. package/lib/typescript/module/src/components/user-location/UserLocationNativeComponent.d.ts.map +1 -0
  85. package/lib/typescript/module/src/components/user-location/UserLocationPuck.d.ts +2 -1
  86. package/lib/typescript/module/src/components/user-location/UserLocationPuck.d.ts.map +1 -1
  87. package/lib/typescript/module/src/components/user-location/UserLocationPuckHeading.d.ts.map +1 -1
  88. package/lib/typescript/module/src/hooks/useCurrentPosition.d.ts +18 -0
  89. package/lib/typescript/module/src/hooks/useCurrentPosition.d.ts.map +1 -0
  90. package/lib/typescript/module/src/index.d.ts +3 -3
  91. package/lib/typescript/module/src/index.d.ts.map +1 -1
  92. package/lib/typescript/module/src/modules/location/LocationManager.d.ts +3 -3
  93. package/lib/typescript/module/src/modules/location/LocationManager.d.ts.map +1 -1
  94. package/lib/typescript/module/src/modules/location/NativeLocationModule.d.ts +3 -3
  95. package/lib/typescript/module/src/modules/location/NativeLocationModule.d.ts.map +1 -1
  96. package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -13
  97. package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
  98. package/package.json +3 -2
  99. package/src/components/annotations/Annotation.tsx +7 -5
  100. package/src/components/sources/ShapeSource.tsx +1 -0
  101. package/src/components/user-location/NativeUserLocation.tsx +15 -19
  102. package/src/components/user-location/UserLocation.tsx +65 -249
  103. package/src/components/user-location/UserLocationNativeComponent.ts +19 -0
  104. package/src/components/user-location/UserLocationPuck.tsx +47 -28
  105. package/src/components/user-location/UserLocationPuckHeading.tsx +2 -1
  106. package/src/hooks/useCurrentPosition.ts +53 -0
  107. package/src/index.ts +5 -6
  108. package/src/modules/location/LocationManager.ts +3 -3
  109. package/src/modules/location/NativeLocationModule.ts +3 -3
  110. package/src/utils/animated/Animated.ts +1 -28
  111. package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +0 -165
  112. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.java +0 -76
  113. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.java +0 -40
  114. package/ios/components/user-location/MLRNNativeUserLocationManager.h +0 -5
  115. package/ios/components/user-location/MLRNNativeUserLocationManager.m +0 -21
  116. package/lib/commonjs/modules/location/requestAndroidLocationPermissions.js +0 -14
  117. package/lib/commonjs/modules/location/requestAndroidLocationPermissions.js.map +0 -1
  118. package/lib/module/modules/location/requestAndroidLocationPermissions.js +0 -11
  119. package/lib/module/modules/location/requestAndroidLocationPermissions.js.map +0 -1
  120. package/lib/typescript/commonjs/src/modules/location/requestAndroidLocationPermissions.d.ts +0 -5
  121. package/lib/typescript/commonjs/src/modules/location/requestAndroidLocationPermissions.d.ts.map +0 -1
  122. package/lib/typescript/module/src/modules/location/requestAndroidLocationPermissions.d.ts +0 -5
  123. package/lib/typescript/module/src/modules/location/requestAndroidLocationPermissions.d.ts.map +0 -1
  124. package/src/modules/location/requestAndroidLocationPermissions.ts +0 -8
@@ -14,10 +14,8 @@ import org.maplibre.reactnative.location.TrackUserLocationMode
14
14
  import org.maplibre.reactnative.utils.GeoJSONUtils
15
15
 
16
16
  @ReactModule(name = MLRNCameraManager.REACT_CLASS)
17
- class MLRNCameraManager(private val mContext: ReactApplicationContext) :
18
- ViewGroupManager<MLRNCamera>(
19
-
20
- ), MLRNCameraManagerInterface<MLRNCamera> {
17
+ class MLRNCameraManager(private val context: ReactApplicationContext) :
18
+ ViewGroupManager<MLRNCamera>(), MLRNCameraManagerInterface<MLRNCamera> {
21
19
  private val delegate: MLRNCameraManagerDelegate<MLRNCamera, MLRNCameraManager> =
22
20
  MLRNCameraManagerDelegate(this)
23
21
 
@@ -42,7 +40,7 @@ class MLRNCameraManager(private val mContext: ReactApplicationContext) :
42
40
  @ReactProp(name = "initialViewState")
43
41
  override fun setInitialViewState(camera: MLRNCamera, value: ReadableMap?) {
44
42
  if (value != null && !camera.hasInitialViewState()) {
45
- val stop = CameraStop.fromReadableMap(mContext, value, null)
43
+ val stop = CameraStop.fromReadableMap(context, value, null)
46
44
  camera.setInitialViewState(stop)
47
45
  }
48
46
  }
@@ -0,0 +1,154 @@
1
+ package org.maplibre.reactnative.components.location
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.content.Context
5
+ import org.maplibre.android.location.LocationComponent
6
+ import org.maplibre.android.location.LocationComponentActivationOptions
7
+ import org.maplibre.android.location.LocationComponentOptions
8
+ import org.maplibre.android.location.OnCameraTrackingChangedListener
9
+ import org.maplibre.android.location.modes.CameraMode
10
+ import org.maplibre.android.location.modes.RenderMode
11
+ import org.maplibre.android.maps.MapLibreMap
12
+ import org.maplibre.android.maps.Style
13
+ import org.maplibre.reactnative.R
14
+ import org.maplibre.reactnative.components.mapview.MLRNMapView
15
+ import org.maplibre.reactnative.location.LocationManager
16
+
17
+ /**
18
+ * The LocationComponent on android implements both location tracking and display of user's current location.
19
+ * LocationComponentManager attempts to separate that, so that Camera can ask for location tracking independent of display of user current location.
20
+ * And NativeUserLocation can ask for display of user's current location - independent of Camera's user tracking.
21
+ */
22
+ class LocationComponentManager(mapView: MLRNMapView?, private val context: Context) {
23
+ private var mMapView: MLRNMapView? = null
24
+ private var mMap: MapLibreMap? = null
25
+
26
+ private var mLocationManager: LocationManager? = null
27
+ private var mLocationComponent: LocationComponent? = null
28
+
29
+ @RenderMode.Mode
30
+ private var mRenderMode: Int = RenderMode.COMPASS
31
+
32
+ private var mShowUserLocation = false
33
+
34
+ private var mFollowUserLocation = false
35
+
36
+ private var mShowingUserLocation = false
37
+
38
+ private var mOnCameraTrackingChangedListener: OnCameraTrackingChangedListener? = null
39
+
40
+ init {
41
+ mMapView = mapView
42
+ mMap = mMapView?.mapLibreMap
43
+
44
+ mLocationManager = LocationManager.getInstance(context)
45
+ }
46
+
47
+ fun showUserLocation(showUserLocation: Boolean) {
48
+ mShowUserLocation = showUserLocation
49
+ stateChanged()
50
+ }
51
+
52
+ fun setFollowUserLocation(followUserLocation: Boolean) {
53
+ mFollowUserLocation = followUserLocation
54
+ stateChanged()
55
+ }
56
+
57
+ fun setCameraMode(@CameraMode.Mode cameraMode: Int) {
58
+ mLocationComponent?.cameraMode = cameraMode
59
+ }
60
+
61
+ fun setRenderMode(@RenderMode.Mode renderMode: Int) {
62
+ mRenderMode = renderMode
63
+ if (mShowingUserLocation) {
64
+ mLocationComponent?.renderMode = renderMode
65
+ }
66
+ }
67
+
68
+ fun setPreferredFramesPerSecond(preferredFramesPerSecond: Int) {
69
+ if (preferredFramesPerSecond <= 0) {
70
+ return
71
+ }
72
+
73
+ mLocationComponent?.setMaxAnimationFps(preferredFramesPerSecond)
74
+ }
75
+
76
+ fun addOnCameraTrackingChangedListener(onCameraTrackingChangedListener: OnCameraTrackingChangedListener?) {
77
+ mOnCameraTrackingChangedListener?.let {
78
+ mLocationComponent?.removeOnCameraTrackingChangedListener(
79
+ it
80
+ )
81
+ }
82
+
83
+ mOnCameraTrackingChangedListener = onCameraTrackingChangedListener
84
+
85
+ mOnCameraTrackingChangedListener?.let { mLocationComponent?.addOnCameraTrackingChangedListener(it) }
86
+ }
87
+
88
+ @SuppressLint("MissingPermission")
89
+ private fun stateChanged() {
90
+ mLocationComponent?.setLocationComponentEnabled((mFollowUserLocation || mShowUserLocation))
91
+
92
+ if (mShowingUserLocation != mShowUserLocation) {
93
+ updateShowUserLocation(mShowUserLocation)
94
+ }
95
+
96
+ if (mFollowUserLocation) {
97
+ if (!mShowUserLocation) {
98
+ mLocationComponent?.renderMode = RenderMode.GPS
99
+ } else {
100
+ mLocationComponent?.renderMode = mRenderMode
101
+ }
102
+ mLocationComponent?.onStart()
103
+ } else {
104
+ mLocationComponent?.cameraMode = CameraMode.NONE
105
+ }
106
+ }
107
+
108
+ fun hasLocationComponent(): Boolean {
109
+ return (mLocationComponent != null)
110
+ }
111
+
112
+ fun update(style: Style) {
113
+ update(mShowUserLocation, style)
114
+ }
115
+
116
+ fun update(displayUserLocation: Boolean, style: Style) {
117
+ val tintColor = mMapView?.tintColor
118
+
119
+ if (mLocationComponent == null || tintColor != null) {
120
+ mLocationComponent = mMap?.locationComponent
121
+
122
+ val locationComponentActivationOptions: LocationComponentActivationOptions =
123
+ LocationComponentActivationOptions.builder(context, style)
124
+ .locationComponentOptions(options(displayUserLocation)).build()
125
+ mLocationComponent?.activateLocationComponent(locationComponentActivationOptions)
126
+ mLocationComponent?.locationEngine = mLocationManager!!.engine
127
+ mShowingUserLocation = displayUserLocation
128
+ }
129
+
130
+ updateShowUserLocation(displayUserLocation)
131
+ }
132
+
133
+ private fun updateShowUserLocation(displayUserLocation: Boolean) {
134
+ if (mShowingUserLocation != displayUserLocation) {
135
+ mLocationComponent?.applyStyle(options(displayUserLocation))
136
+ mShowingUserLocation = displayUserLocation
137
+ }
138
+ }
139
+
140
+ fun options(displayUserLocation: Boolean): LocationComponentOptions {
141
+ var builder: LocationComponentOptions.Builder = LocationComponentOptions.builder(context)
142
+ val tintColor = mMapView?.tintColor
143
+ if (!displayUserLocation) {
144
+ builder = builder.padding(mMap?.getPadding()).backgroundDrawable(R.drawable.empty)
145
+ .backgroundDrawableStale(R.drawable.empty).bearingDrawable(R.drawable.empty)
146
+ .foregroundDrawable(R.drawable.empty).foregroundDrawableStale(R.drawable.empty)
147
+ .gpsDrawable(R.drawable.empty).accuracyAlpha(0.0f)
148
+ } else if (tintColor != null) {
149
+ builder = builder.enableStaleState(false).bearingTintColor(tintColor)
150
+ .foregroundTintColor(tintColor).accuracyColor(tintColor)
151
+ }
152
+ return builder.build()
153
+ }
154
+ }
@@ -0,0 +1,70 @@
1
+ package org.maplibre.reactnative.components.location
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.content.Context
5
+ import org.maplibre.android.location.modes.RenderMode
6
+ import org.maplibre.android.location.permissions.PermissionsManager
7
+ import org.maplibre.android.maps.MapLibreMap
8
+ import org.maplibre.android.maps.OnMapReadyCallback
9
+ import org.maplibre.android.maps.Style
10
+ import org.maplibre.android.maps.Style.OnStyleLoaded
11
+ import org.maplibre.reactnative.components.AbstractMapFeature
12
+ import org.maplibre.reactnative.components.mapview.MLRNMapView
13
+
14
+ class MLRNNativeUserLocation(context: Context?) : AbstractMapFeature(context), OnMapReadyCallback,
15
+ OnStyleLoaded {
16
+ private var enabled = true
17
+ private var map: MapLibreMap? = null
18
+ private var mapView: MLRNMapView? = null
19
+
20
+ @RenderMode.Mode
21
+ private var mRenderMode = RenderMode.COMPASS
22
+ private var mPreferredFramesPerSecond = 0
23
+
24
+ override fun addToMap(mapView: MLRNMapView) {
25
+ enabled = true
26
+ this.mapView = mapView
27
+ mapView.getMapAsync(this)
28
+ setRenderMode(mRenderMode)
29
+ setPreferredFramesPerSecond(mPreferredFramesPerSecond)
30
+ }
31
+
32
+ override fun removeFromMap(mapView: MLRNMapView?) {
33
+ enabled = false
34
+ if (map != null) map!!.getStyle(this)
35
+ }
36
+
37
+ @SuppressLint("MissingPermission")
38
+ override fun onMapReady(mapLibreMap: MapLibreMap) {
39
+ map = mapLibreMap
40
+ mapLibreMap.getStyle(this)
41
+ }
42
+
43
+ @SuppressLint("MissingPermission")
44
+ override fun onStyleLoaded(style: Style) {
45
+ val context = getContext()
46
+ if (!PermissionsManager.areLocationPermissionsGranted(context)) {
47
+ return
48
+ }
49
+
50
+ val locationComponent = mapView!!.locationComponentManager
51
+ locationComponent.update(style)
52
+ locationComponent.showUserLocation(enabled)
53
+ }
54
+
55
+ fun setRenderMode(@RenderMode.Mode renderMode: Int) {
56
+ mRenderMode = renderMode
57
+ if (mapView != null) {
58
+ val locationComponent = mapView!!.locationComponentManager
59
+ locationComponent.setRenderMode(renderMode)
60
+ }
61
+ }
62
+
63
+ fun setPreferredFramesPerSecond(framesPerSecond: Int) {
64
+ mPreferredFramesPerSecond = framesPerSecond
65
+ if (mapView != null) {
66
+ val locationComponent = mapView!!.locationComponentManager
67
+ locationComponent.setPreferredFramesPerSecond(framesPerSecond)
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,50 @@
1
+ package org.maplibre.reactnative.components.location
2
+
3
+ import com.facebook.react.module.annotations.ReactModule
4
+ import com.facebook.react.uimanager.ThemedReactContext
5
+ import com.facebook.react.uimanager.ViewGroupManager
6
+ import com.facebook.react.uimanager.ViewManagerDelegate
7
+ import com.facebook.react.uimanager.annotations.ReactProp
8
+ import com.facebook.react.viewmanagers.MLRNNativeUserLocationManagerDelegate
9
+ import com.facebook.react.viewmanagers.MLRNNativeUserLocationManagerInterface
10
+ import org.maplibre.android.location.modes.RenderMode
11
+
12
+ @ReactModule(name = MLRNNativeUserLocationManager.REACT_CLASS)
13
+ class MLRNNativeUserLocationManager() :
14
+ ViewGroupManager<MLRNNativeUserLocation>(),
15
+ MLRNNativeUserLocationManagerInterface<MLRNNativeUserLocation> {
16
+ private val delegate: MLRNNativeUserLocationManagerDelegate<MLRNNativeUserLocation, MLRNNativeUserLocationManager> =
17
+ MLRNNativeUserLocationManagerDelegate(this)
18
+
19
+ override fun getDelegate(): ViewManagerDelegate<MLRNNativeUserLocation> = delegate
20
+
21
+ companion object {
22
+ const val REACT_CLASS: String = "MLRNNativeUserLocation"
23
+ }
24
+
25
+ override fun getName(): String = REACT_CLASS
26
+
27
+ override fun createViewInstance(context: ThemedReactContext): MLRNNativeUserLocation {
28
+ return MLRNNativeUserLocation(context)
29
+ }
30
+
31
+ @ReactProp(name = "mode")
32
+ override fun setMode(userLocation: MLRNNativeUserLocation, mode: String?) {
33
+ if ("heading".equals(mode, ignoreCase = true)) {
34
+ userLocation.setRenderMode(RenderMode.COMPASS)
35
+ } else if ("course".equals(mode, ignoreCase = true)) {
36
+ userLocation.setRenderMode(RenderMode.GPS)
37
+ } else {
38
+ userLocation.setRenderMode(RenderMode.NORMAL)
39
+ }
40
+ }
41
+
42
+ @ReactProp(name = "androidPreferredFramesPerSecond")
43
+ override fun setAndroidPreferredFramesPerSecond(
44
+ userLocation: MLRNNativeUserLocation, preferredFramesPerSecond: Int
45
+ ) {
46
+ userLocation.setPreferredFramesPerSecond(preferredFramesPerSecond)
47
+ }
48
+
49
+
50
+ }
@@ -134,15 +134,31 @@ class MLRNLocationModule(reactContext: ReactApplicationContext) :
134
134
 
135
135
  coords.putDouble("longitude", location.longitude)
136
136
  coords.putDouble("latitude", location.latitude)
137
- coords.putDouble("altitude", location.altitude)
138
137
  coords.putDouble("accuracy", location.accuracy.toDouble())
139
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
138
+
139
+ if (location.hasAltitude()) {
140
+ coords.putDouble("altitude", location.altitude)
141
+ } else {
142
+ coords.putNull("altitude")
143
+ }
144
+
145
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && location.hasVerticalAccuracy()) {
140
146
  coords.putDouble("altitudeAccuracy", location.verticalAccuracyMeters.toDouble())
141
147
  } else {
142
148
  coords.putNull("altitudeAccuracy")
143
149
  }
144
- coords.putDouble("heading", location.bearing.toDouble())
145
- coords.putDouble("speed", location.speed.toDouble())
150
+
151
+ if (location.hasBearing()) {
152
+ coords.putDouble("heading", location.bearing.toDouble())
153
+ } else {
154
+ coords.putNull("heading")
155
+ }
156
+
157
+ if (location.hasSpeed()) {
158
+ coords.putDouble("speed", location.speed.toDouble())
159
+ } else {
160
+ coords.putNull("speed")
161
+ }
146
162
 
147
163
  val geolocationPosition: WritableMap = WritableNativeMap()
148
164
  geolocationPosition.putMap("coords", coords)
@@ -1,12 +1,6 @@
1
1
  #import <React/RCTViewComponentView.h>
2
2
  #import <UIKit/UIKit.h>
3
3
 
4
- #import <React/RCTUIManager.h>
5
- #import <React/RCTViewComponentView.h>
6
-
7
- #ifndef MLRNCameraComponentView_h
8
- #define MLRNCameraComponentView_h
9
-
10
4
  NS_ASSUME_NONNULL_BEGIN
11
5
 
12
6
  @interface MLRNCameraComponentView : RCTViewComponentView
@@ -14,5 +8,3 @@ NS_ASSUME_NONNULL_BEGIN
14
8
  @end
15
9
 
16
10
  NS_ASSUME_NONNULL_END
17
-
18
- #endif
@@ -351,7 +351,7 @@ static double const M2PI = M_PI * 2;
351
351
  MLRNStyle *style = [[MLRNStyle alloc] init];
352
352
  [style lightLayer:light
353
353
  withReactStyle:_reactLight
354
- isValid:^BOOL{
354
+ isValid:^BOOL {
355
355
  return self.style != nil;
356
356
  }];
357
357
  self.style.light = light;
@@ -4,9 +4,6 @@
4
4
  #import <React/RCTUIManager.h>
5
5
  #import <React/RCTViewComponentView.h>
6
6
 
7
- #ifndef MLRNMapViewComponentView_h
8
- #define MLRNMapViewComponentView_h
9
-
10
7
  NS_ASSUME_NONNULL_BEGIN
11
8
 
12
9
  @interface MLRNMapViewComponentView : RCTViewComponentView
@@ -14,5 +11,3 @@ NS_ASSUME_NONNULL_BEGIN
14
11
  @end
15
12
 
16
13
  NS_ASSUME_NONNULL_END
17
-
18
- #endif
@@ -115,11 +115,13 @@
115
115
  coordinate:(JS::NativeMapViewModule::SpecProjectCoordinate &)coordinate
116
116
  resolve:(RCTPromiseResolveBlock)resolve
117
117
  reject:(RCTPromiseRejectBlock)reject {
118
+ CLLocationCoordinate2D transformedCoordinate =
119
+ CLLocationCoordinate2DMake(coordinate.latitude(), coordinate.longitude());
120
+
118
121
  [self withMapView:reactTag
119
122
  block:^(MLRNMapView *view) {
120
123
  [MLRNMapViewManager project:view
121
- coordinate:CLLocationCoordinate2DMake(coordinate.latitude(),
122
- coordinate.longitude())
124
+ coordinate:transformedCoordinate
123
125
  resolve:resolve
124
126
  reject:reject];
125
127
  }
@@ -131,10 +133,12 @@
131
133
  point:(JS::NativeMapViewModule::SpecUnprojectPoint &)point
132
134
  resolve:(RCTPromiseResolveBlock)resolve
133
135
  reject:(RCTPromiseRejectBlock)reject {
136
+ CGPoint transformedPoint = CGPointMake(point.locationX(), point.locationY());
137
+
134
138
  [self withMapView:reactTag
135
139
  block:^(MLRNMapView *view) {
136
140
  [MLRNMapViewManager unproject:view
137
- point:CGPointMake(point.locationX(), point.locationY())
141
+ point:transformedPoint
138
142
  resolve:resolve
139
143
  reject:reject];
140
144
  }
@@ -166,6 +170,9 @@
166
170
  filter:(nonnull NSArray *)filter
167
171
  resolve:(nonnull RCTPromiseResolveBlock)resolve
168
172
  reject:(nonnull RCTPromiseRejectBlock)reject {
173
+ CLLocationCoordinate2D transformedCoordinate =
174
+ CLLocationCoordinate2DMake(coordinate.latitude(), coordinate.longitude());
175
+
169
176
  [self withMapView:reactTag
170
177
  block:^(MLRNMapView *view) {
171
178
  NSSet *layerIdSet = nil;
@@ -176,9 +183,7 @@
176
183
  NSPredicate *predicate = [FilterParser parse:filter];
177
184
 
178
185
  [MLRNMapViewManager queryRenderedFeaturesWithCoordinate:view
179
- coordinate:CLLocationCoordinate2D(
180
- coordinate.latitude(),
181
- coordinate.longitude())
186
+ coordinate:transformedCoordinate
182
187
  layerIds:layerIdSet
183
188
  predicate:predicate
184
189
  resolve:resolve
@@ -6,6 +6,6 @@
6
6
  @interface MLRNNativeUserLocation : UIView
7
7
 
8
8
  @property (nonatomic, strong) MLRNMapView *map;
9
- @property (nonatomic) BOOL iosShowsUserHeadingIndicator;
9
+ @property (nonatomic) BOOL showsUserHeadingIndicator;
10
10
 
11
11
  @end
@@ -17,20 +17,21 @@
17
17
  _map.showsUserHeadingIndicator = NO;
18
18
  } else if (map) {
19
19
  map.useNativeUserLocationAnnotationView = YES;
20
- // Toggle off/on showsUserLocation in order for Mapbox to invalidate the
20
+ // Toggle off/on showsUserLocation in order for MapLibre Native to invalidate the
21
21
  // current (hidden) user location annotation view. See also: HiddenUserLocationAnnotationView
22
22
  map.showsUserLocation = NO;
23
23
  map.showsUserLocation = YES;
24
- map.showsUserHeadingIndicator = self.iosShowsUserHeadingIndicator;
24
+ map.showsUserHeadingIndicator = self.showsUserHeadingIndicator;
25
25
  }
26
26
 
27
27
  _map = map;
28
28
  }
29
29
 
30
- - (void)setIosShowsUserHeadingIndicator:(BOOL)iosShowsUserHeadingIndicator {
31
- _iosShowsUserHeadingIndicator = iosShowsUserHeadingIndicator;
30
+ - (void)setShowsUserHeadingIndicator:(BOOL)showsUserHeadingIndicator {
31
+ _showsUserHeadingIndicator = showsUserHeadingIndicator;
32
+
32
33
  if (_map) {
33
- _map.showsUserHeadingIndicator = iosShowsUserHeadingIndicator;
34
+ _map.showsUserHeadingIndicator = showsUserHeadingIndicator;
34
35
  }
35
36
  }
36
37
 
@@ -0,0 +1,10 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ @interface MLRNNativeUserLocationComponentView : RCTViewComponentView
7
+
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,51 @@
1
+ #import "MLRNNativeUserLocationComponentView.h"
2
+
3
+ #import <react/renderer/components/MapLibreReactNativeSpec/ComponentDescriptors.h>
4
+ #import <react/renderer/components/MapLibreReactNativeSpec/Props.h>
5
+ #import <react/renderer/components/MapLibreReactNativeSpec/RCTComponentViewHelpers.h>
6
+
7
+ #import "MLRNNativeUserLocation.h"
8
+
9
+ using namespace facebook::react;
10
+
11
+ @interface MLRNNativeUserLocationComponentView () <RCTMLRNNativeUserLocationViewProtocol>
12
+
13
+ @end
14
+
15
+ @implementation MLRNNativeUserLocationComponentView {
16
+ MLRNNativeUserLocation *_view;
17
+ }
18
+
19
+ - (instancetype)initWithFrame:(CGRect)frame {
20
+ if (self = [super initWithFrame:frame]) {
21
+ static const auto defaultProps = std::make_shared<const MLRNNativeUserLocationProps>();
22
+ _props = defaultProps;
23
+ [self prepareView];
24
+ }
25
+
26
+ return self;
27
+ }
28
+
29
+ - (void)prepareView {
30
+ _view = [[MLRNNativeUserLocation alloc] init];
31
+ self.contentView = _view;
32
+ }
33
+
34
+ #pragma mark - RCTComponentViewProtocol
35
+
36
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
37
+ const auto &oldViewProps = *std::static_pointer_cast<MLRNNativeUserLocationProps const>(_props);
38
+ const auto &newViewProps = *std::static_pointer_cast<MLRNNativeUserLocationProps const>(props);
39
+
40
+ if (oldViewProps.mode != newViewProps.mode) {
41
+ [_view setShowsUserHeadingIndicator:newViewProps.mode != MLRNNativeUserLocationMode::Default];
42
+ }
43
+
44
+ [super updateProps:props oldProps:oldProps];
45
+ }
46
+
47
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
48
+ return concreteComponentDescriptorProvider<MLRNNativeUserLocationComponentDescriptor>();
49
+ }
50
+
51
+ @end
@@ -2,22 +2,25 @@
2
2
 
3
3
  @implementation MLRNLocation
4
4
 
5
- - (NSDictionary<NSString *, id> *)toJSON {
6
- NSMutableDictionary<NSString *, id> *json = [[NSMutableDictionary alloc] init];
7
-
8
- NSMutableDictionary<NSString *, NSNumber *> *coords = [[NSMutableDictionary alloc] init];
9
- coords[@"longitude"] = @(_location.coordinate.longitude);
10
- coords[@"latitude"] = @(_location.coordinate.latitude);
11
- coords[@"accuracy"] = @(_location.horizontalAccuracy);
12
- coords[@"altitude"] = @(_location.altitude);
13
- coords[@"altitudeAccuracy"] = @(_location.verticalAccuracy);
14
- coords[@"heading"] = @(_location.course);
15
- coords[@"speed"] = @(_location.speed);
5
+ - (id)numberOrNull:(double)value {
6
+ return value < 0 ? [NSNull null] : @(value);
7
+ }
16
8
 
17
- json[@"coords"] = coords;
18
- json[@"timestamp"] = @([_location.timestamp timeIntervalSince1970]);
9
+ - (NSDictionary<NSString *, id> *)toJSON {
10
+ double altitudeAccuracy = _location.verticalAccuracy;
19
11
 
20
- return json;
12
+ return @{
13
+ @"coords" : @{
14
+ @"longitude" : @(_location.coordinate.longitude),
15
+ @"latitude" : @(_location.coordinate.latitude),
16
+ @"accuracy" : @(_location.horizontalAccuracy),
17
+ @"altitude" : altitudeAccuracy < 0 ? [NSNull null] : @(_location.altitude),
18
+ @"altitudeAccuracy" : [self numberOrNull:altitudeAccuracy],
19
+ @"heading" : [self numberOrNull:_location.course],
20
+ @"speed" : [self numberOrNull:_location.speed]
21
+ },
22
+ @"timestamp" : @([_location.timestamp timeIntervalSince1970])
23
+ };
21
24
  }
22
25
 
23
26
  @end
@@ -1,6 +1,3 @@
1
- #ifndef MLRNLogging_h
2
- #define MLRNLogging_h
3
-
4
1
  #import <Foundation/Foundation.h>
5
2
  #import <React/RCTEventEmitter.h>
6
3
 
@@ -11,5 +8,3 @@
11
8
  @property (nonatomic, nonnull) MLNLoggingConfiguration* loggingConfiguration;
12
9
 
13
10
  @end
14
-
15
- #endif /* MLRNLogging_h */
@@ -84,8 +84,9 @@ const Annotation = exports.Annotation = /*#__PURE__*/(0, _react.forwardRef)(({
84
84
  children.push(props.children);
85
85
  }
86
86
  }
87
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Animated.AnimatedShapeSource, {
87
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Animated.Animated.ShapeSource, {
88
88
  id: props.id,
89
+ testID: props.testID,
89
90
  onPress: props.onPress,
90
91
  shape: shape,
91
92
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_Animated","_AnimatedPoint","_SymbolLayer","_jsxRuntime","getShapeFromProps","props","lng","coordinates","lat","point","type","animated","AnimatedPoint","isShapeAnimated","shape","Annotation","exports","forwardRef","animationDuration","animationEasingFunction","Easing","linear","otherProps","ref","useImperativeHandle","symbolStyle","setShape","useState","coordinateDeps","join","useEffect","Array","isArray","stopAnimation","timing","easing","duration","start","newShape","children","icon","style","iconImage","undefined","push","jsx","SymbolLayer","id","AnimatedShapeSource","onPress","displayName"],"sourceRoot":"../../../../src","sources":["components/annotations/Annotation.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAoD,IAAAK,WAAA,GAAAL,OAAA;AAgBpD,SAASM,iBAAiBA,CAACC,KAA+B,GAAG,CAAC,CAAC,EAA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IAAApC,WAAA,CAAA0C,GAAA,EAAC7C,SAAA,CAAAgD,mBAAmB;IAClBD,EAAE,EAAE1C,KAAK,CAAC0C,EAAG;IACbE,OAAO,EAAE5C,KAAK,CAAC4C,OAAQ;IACvBnC,KAAK,EAAEA,KAAsD;IAAAyB,QAAA,EAE5DA;EAAQ,CACU,CAAC;AAE1B,CACF,CAAC;AAEDxB,UAAU,CAACmC,WAAW,GAAG,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_Animated","_AnimatedPoint","_SymbolLayer","_jsxRuntime","getShapeFromProps","props","lng","coordinates","lat","point","type","animated","AnimatedPoint","isShapeAnimated","shape","Annotation","exports","forwardRef","animationDuration","animationEasingFunction","Easing","linear","otherProps","ref","useImperativeHandle","symbolStyle","setShape","useState","coordinateDeps","join","useEffect","Array","isArray","stopAnimation","timing","easing","duration","start","newShape","children","icon","style","iconImage","undefined","push","jsx","SymbolLayer","id","Animated","ShapeSource","testID","onPress","displayName"],"sourceRoot":"../../../../src","sources":["components/annotations/Annotation.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAoD,IAAAK,WAAA,GAAAL,OAAA;AAgBpD,SAASM,iBAAiBA,CAACC,KAA+B,GAAG,CAAC,CAAC,EAAS;EACtE,MAAMC,GAAG,GAAGD,KAAK,CAACE,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;EACvC,MAAMC,GAAG,GAAGH,KAAK,CAACE,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;EACvC,MAAME,KAAoB,GAAG;IAAEC,IAAI,EAAE,OAAO;IAAEH,WAAW,EAAE,CAACD,GAAG,EAAEE,GAAG;EAAE,CAAC;EAEvE,IAAIH,KAAK,CAACM,QAAQ,EAAE;IAClB,OAAO,I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GAAG,YAAY","ignoreList":[]}
@@ -123,6 +123,7 @@ const ShapeSource = exports.ShapeSource = /*#__PURE__*/(0, _react.memo)(/*#__PUR
123
123
  }
124
124
  const shapeProps = {
125
125
  id: shapeId,
126
+ testID: props.testID,
126
127
  url: props.url,
127
128
  shape: _getShape(),
128
129
  hitbox: props.hitbox,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_useNativeBridge","_index","_filterUtils","_jsxRuntime","MLRNModule","NativeModules","NATIVE_MODULE_NAME","exports","ShapeSource","memo","forwardRef","id","shapeId","StyleSource","DefaultSourceID","props","ref","useImperativeHandle","_nativeRef","current","features","getClusterExpansionZoom","getClusterLeaves","getClusterChildren","setNativeProps","useRef","_runNativeCommand","_runPendingNativeCommands","_onAndroidCallback","useNativeBridge","_setNativeRef","nativeRef","filter","res","getFilter","isAndroid","JSON","parse","data","feature","stringify","limit","offset","nativeProps","shallowProps","Object","assign","shape","_getShape","undefined","toJSONString","shapeProps","url","hitbox","hasPressListener","onPress","onMapboxShapeSourcePress","cluster","clusterRadius","clusterMinPoints","clusterMaxZoomLevel","clusterProperties","maxZoomLevel","buffer","tolerance","lineMetrics","onAndroidCallback","jsx","MLRNShapeSource","children","cloneReactChildrenWithProps","sourceID","requireNativeComponent"],"sourceRoot":"../../../../src","sources":["components/sources/ShapeSource.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,gBAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAAoD,IAAAK,WAAA,GAAAL,OAAA;AAEpD,MAAMM,UAAU,GAAGC,0BAAa,CAACD,UAAU;AACpC,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,iBAAiB;AA2InD;AACA;AACA;AACA;AACO,MAAME,WAAW,GAAAD,OAAA,CAAAC,WAAA,gBAAG,IAAAC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AC,CACa,CAAC;AAEtB,CACF,CACF,CAAC;AAED,MAAMwD,eAAe,GAAG,IAAAI,mCAAsB,EAAclE,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_useNativeBridge","_index","_filterUtils","_jsxRuntime","MLRNModule","NativeModules","NATIVE_MODULE_NAME","exports","ShapeSource","memo","forwardRef","id","shapeId","StyleSource","DefaultSourceID","props","ref","useImperativeHandle","_nativeRef","current","features","getClusterExpansionZoom","getClusterLeaves","getClusterChildren","setNativeProps","useRef","_runNativeCommand","_runPendingNativeCommands","_onAndroidCallback","useNativeBridge","_setNativeRef","nativeRef","filter","res","getFilter","isAndroid","JSON","parse","data","feature","stringify","limit","offset","nativeProps","shallowProps","Object","assign","shape","_getShape","undefined","toJSONString","shapeProps","testID","url","hitbox","hasPressListener","onPress","onMapboxShapeSourcePress","cluster","clusterRadius","clusterMinPoints","clusterMaxZoomLevel","clusterProperties","maxZoomLevel","buffer","tolerance","lineMetrics","onAndroidCallback","jsx","MLRNShapeSource","children","cloneReactChildrenWithProps","sourceID","requireNativeComponent"],"sourceRoot":"../../../../src","sources":["components/sources/ShapeSource.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,gBAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAAoD,IAAAK,WAAA,GAAAL,OAAA;AAEpD,MAAMM,UAAU,GAAGC,0BAAa,CAACD,UAAU;AACpC,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,iBAAiB;AA2InD;AACA;AACA;AACA;AACO,MAAME,WAAW,GAAAD,OAAA,CAAAC,WAAA,gBAAG,IAAAC,WAAI,eAC7B,IAAAC,iBAAU,EACR,CACE;EACEC,EAAE,EAAEC,OAAO,GAAGR,UAAU,CAACS,WAAW,CAACC,eAAe;EACpD,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