@maplibre/maplibre-react-native 11.0.0-alpha.31 → 11.0.0-alpha.33
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 +1 -1
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +10 -12
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +9 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +5 -1
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +6 -24
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.kt +561 -0
- package/ios/components/map-view/MLRNMapView.h +1 -0
- package/ios/components/map-view/MLRNMapView.m +5 -0
- package/ios/components/map-view/MLRNMapViewComponentView.mm +4 -0
- package/ios/modules/mlrn/MLRNModule.m +0 -13
- package/ios/modules/offline/MLRNOfflineModule.h +4 -7
- package/ios/modules/offline/MLRNOfflineModule.mm +693 -0
- package/lib/commonjs/MLRNModule.js +1 -3
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/components/map-view/AndroidTextureMapViewNativeComponent.ts +1 -0
- package/lib/commonjs/components/map-view/MapView.js.map +1 -1
- package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +1 -0
- package/lib/commonjs/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/offline/NativeOfflineModule.js +9 -0
- package/lib/commonjs/modules/offline/NativeOfflineModule.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflineManager.js +124 -164
- package/lib/commonjs/modules/offline/OfflineManager.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflinePack.js +15 -25
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
- package/lib/module/MLRNModule.js +0 -1
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/components/map-view/AndroidTextureMapViewNativeComponent.ts +1 -0
- package/lib/module/components/map-view/MapView.js.map +1 -1
- package/lib/module/components/map-view/MapViewNativeComponent.ts +1 -0
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/offline/NativeOfflineModule.js +5 -0
- package/lib/module/modules/offline/NativeOfflineModule.js.map +1 -0
- package/lib/module/modules/offline/OfflineManager.js +123 -163
- package/lib/module/modules/offline/OfflineManager.js.map +1 -1
- package/lib/module/modules/offline/OfflinePack.js +14 -25
- package/lib/module/modules/offline/OfflinePack.js.map +1 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -6
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -5
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/NativeOfflineModule.d.ts +50 -0
- package/lib/typescript/commonjs/src/modules/offline/NativeOfflineModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/offline/OfflineManager.d.ts +66 -69
- package/lib/typescript/commonjs/src/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts +11 -9
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/module/src/MLRNModule.d.ts +1 -6
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts +1 -0
- package/lib/typescript/module/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/MapView.d.ts +6 -0
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +1 -0
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -5
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/NativeOfflineModule.d.ts +50 -0
- package/lib/typescript/module/src/modules/offline/NativeOfflineModule.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/offline/OfflineManager.d.ts +66 -69
- package/lib/typescript/module/src/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts +11 -9
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/MLRNModule.ts +0 -8
- package/src/components/map-view/AndroidTextureMapViewNativeComponent.ts +1 -0
- package/src/components/map-view/MapView.tsx +7 -0
- package/src/components/map-view/MapViewNativeComponent.ts +1 -0
- package/src/index.ts +13 -5
- package/src/modules/offline/NativeOfflineModule.ts +63 -0
- package/src/modules/offline/OfflineManager.ts +174 -210
- package/src/modules/offline/OfflinePack.ts +22 -32
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.java +0 -586
- package/ios/modules/offline/MLRNOfflineModule.m +0 -524
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +0 -37
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +0 -1
- package/lib/commonjs/utils/makeNativeBounds.js +0 -11
- package/lib/commonjs/utils/makeNativeBounds.js.map +0 -1
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +0 -32
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +0 -1
- package/lib/module/utils/makeNativeBounds.js +0 -7
- package/lib/module/utils/makeNativeBounds.js.map +0 -1
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts +0 -20
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/makeNativeBounds.d.ts +0 -2
- package/lib/typescript/commonjs/src/utils/makeNativeBounds.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts +0 -20
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/makeNativeBounds.d.ts +0 -2
- package/lib/typescript/module/src/utils/makeNativeBounds.d.ts.map +0 -1
- package/src/modules/offline/OfflineCreatePackOptions.ts +0 -53
- package/src/utils/makeNativeBounds.ts +0 -5
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ with [MapLibre Native for Android & iOS](https://github.com/maplibre/maplibre-gl
|
|
|
19
19
|
|
|
20
20
|
> [!IMPORTANT]
|
|
21
21
|
> This is the v11 alpha branch, which **only supports the new architecture**. Not all components and modules have been ported yet.
|
|
22
|
-
>
|
|
22
|
+
>
|
|
23
23
|
> Please refer to the [v11 migration guide](https://github.com/maplibre/maplibre-react-native/blob/alpha/docs/content/setup/migrations/v11.md) for upgrading.
|
|
24
24
|
|
|
25
25
|
This project originated as a fork of [rnmapbox](https://github.com/rnmapbox/maps), a community-maintained
|
|
@@ -12,10 +12,6 @@ import org.maplibre.reactnative.components.annotations.MLRNPointAnnotationManage
|
|
|
12
12
|
import org.maplibre.reactnative.components.camera.MLRNCameraManager
|
|
13
13
|
import org.maplibre.reactnative.components.camera.MLRNCameraModule
|
|
14
14
|
import org.maplibre.reactnative.components.images.MLRNImagesManager
|
|
15
|
-
import org.maplibre.reactnative.components.location.MLRNNativeUserLocationManager
|
|
16
|
-
import org.maplibre.reactnative.components.mapview.MLRNAndroidTextureMapViewManager
|
|
17
|
-
import org.maplibre.reactnative.components.mapview.MLRNMapViewManager
|
|
18
|
-
import org.maplibre.reactnative.components.mapview.MLRNMapViewModule
|
|
19
15
|
import org.maplibre.reactnative.components.layers.MLRNBackgroundLayerManager
|
|
20
16
|
import org.maplibre.reactnative.components.layers.MLRNCircleLayerManager
|
|
21
17
|
import org.maplibre.reactnative.components.layers.MLRNFillExtrusionLayerManager
|
|
@@ -24,6 +20,10 @@ import org.maplibre.reactnative.components.layers.MLRNHeatmapLayerManager
|
|
|
24
20
|
import org.maplibre.reactnative.components.layers.MLRNLineLayerManager
|
|
25
21
|
import org.maplibre.reactnative.components.layers.MLRNRasterLayerManager
|
|
26
22
|
import org.maplibre.reactnative.components.layers.MLRNSymbolLayerManager
|
|
23
|
+
import org.maplibre.reactnative.components.location.MLRNNativeUserLocationManager
|
|
24
|
+
import org.maplibre.reactnative.components.mapview.MLRNAndroidTextureMapViewManager
|
|
25
|
+
import org.maplibre.reactnative.components.mapview.MLRNMapViewManager
|
|
26
|
+
import org.maplibre.reactnative.components.mapview.MLRNMapViewModule
|
|
27
27
|
import org.maplibre.reactnative.components.sources.imagesource.MLRNImageSourceManager
|
|
28
28
|
import org.maplibre.reactnative.components.sources.shapesource.MLRNShapeSourceManager
|
|
29
29
|
import org.maplibre.reactnative.components.sources.shapesource.MLRNShapeSourceModule
|
|
@@ -37,7 +37,6 @@ import org.maplibre.reactnative.modules.MLRNOfflineModule
|
|
|
37
37
|
import org.maplibre.reactnative.modules.MLRNSnapshotModule
|
|
38
38
|
import org.maplibre.reactnative.utils.ReactTagResolver
|
|
39
39
|
|
|
40
|
-
|
|
41
40
|
class MLRNPackage : BaseReactPackage() {
|
|
42
41
|
override fun getModule(
|
|
43
42
|
name: String,
|
|
@@ -49,6 +48,7 @@ class MLRNPackage : BaseReactPackage() {
|
|
|
49
48
|
reactContext,
|
|
50
49
|
getReactTagResolver(reactContext)
|
|
51
50
|
)
|
|
51
|
+
|
|
52
52
|
MLRNCameraModule.NAME -> return MLRNCameraModule(
|
|
53
53
|
reactContext,
|
|
54
54
|
getReactTagResolver(reactContext)
|
|
@@ -64,8 +64,7 @@ class MLRNPackage : BaseReactPackage() {
|
|
|
64
64
|
getReactTagResolver(reactContext)
|
|
65
65
|
)
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
MLRNOfflineModule.REACT_CLASS -> return MLRNOfflineModule(reactContext)
|
|
67
|
+
MLRNOfflineModule.NAME -> return MLRNOfflineModule(reactContext)
|
|
69
68
|
MLRNSnapshotModule.NAME -> return MLRNSnapshotModule(reactContext)
|
|
70
69
|
MLRNLocationModule.NAME -> return MLRNLocationModule(reactContext)
|
|
71
70
|
MLRNLogModule.NAME -> return MLRNLogModule(reactContext)
|
|
@@ -123,14 +122,13 @@ class MLRNPackage : BaseReactPackage() {
|
|
|
123
122
|
isTurboModule = true
|
|
124
123
|
)
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
MLRNOfflineModule.
|
|
129
|
-
MLRNOfflineModule.REACT_CLASS,
|
|
125
|
+
moduleInfos[MLRNOfflineModule.NAME] = ReactModuleInfo(
|
|
126
|
+
MLRNOfflineModule.NAME,
|
|
127
|
+
MLRNOfflineModule.NAME,
|
|
130
128
|
canOverrideExistingModule = false,
|
|
131
129
|
needsEagerInit = false,
|
|
132
130
|
isCxxModule = false,
|
|
133
|
-
isTurboModule =
|
|
131
|
+
isTurboModule = true
|
|
134
132
|
)
|
|
135
133
|
|
|
136
134
|
moduleInfos[MLRNSnapshotModule.NAME] = ReactModuleInfo(
|
|
@@ -137,6 +137,7 @@ open class MLRNMapView(
|
|
|
137
137
|
private var compassEnabled: Boolean? = null
|
|
138
138
|
private var compassGravity: Int? = null
|
|
139
139
|
private var compassMargins: IntArray? = null
|
|
140
|
+
private var compassHiddenFacingNorth: Boolean? = null
|
|
140
141
|
|
|
141
142
|
|
|
142
143
|
private var symbolManager: SymbolManager? = null
|
|
@@ -848,6 +849,11 @@ open class MLRNMapView(
|
|
|
848
849
|
{ compassMargins = it })
|
|
849
850
|
}
|
|
850
851
|
|
|
852
|
+
fun setReactCompassHiddenFacingNorth(value: Boolean) {
|
|
853
|
+
compassHiddenFacingNorth = value
|
|
854
|
+
updateUISettings()
|
|
855
|
+
}
|
|
856
|
+
|
|
851
857
|
fun getCenter(): WritableArray {
|
|
852
858
|
val cameraPosition = mapLibreMap!!.cameraPosition
|
|
853
859
|
val center = cameraPosition.target!!
|
|
@@ -1087,6 +1093,9 @@ open class MLRNMapView(
|
|
|
1087
1093
|
compassMargins!![0], compassMargins!![1], compassMargins!![2], compassMargins!![3]
|
|
1088
1094
|
)
|
|
1089
1095
|
}
|
|
1096
|
+
if (compassHiddenFacingNorth != null) {
|
|
1097
|
+
uiSettings.setCompassFadeFacingNorth(compassHiddenFacingNorth!!)
|
|
1098
|
+
}
|
|
1090
1099
|
}
|
|
1091
1100
|
|
|
1092
1101
|
private fun updatePreferredFramesPerSecond() {
|
package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt
CHANGED
|
@@ -160,6 +160,11 @@ open class MLRNMapViewManager(context: ReactApplicationContext) :
|
|
|
160
160
|
override fun setCompassPosition(mapView: MLRNMapView, value: ReadableMap?) {
|
|
161
161
|
mapView.setReactCompassPosition(value)
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
@ReactProp(name = "compassHiddenFacingNorth")
|
|
165
|
+
override fun setCompassHiddenFacingNorth(mapView: MLRNMapView, value: Boolean) {
|
|
166
|
+
mapView.setReactCompassHiddenFacingNorth(value)
|
|
167
|
+
}
|
|
163
168
|
|
|
164
169
|
//endregion
|
|
165
170
|
|
|
@@ -190,4 +195,3 @@ open class MLRNMapViewManager(context: ReactApplicationContext) :
|
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
|
-
|
|
@@ -10,18 +10,17 @@ import com.facebook.react.common.MapBuilder;
|
|
|
10
10
|
import com.facebook.react.module.annotations.ReactModule;
|
|
11
11
|
|
|
12
12
|
import org.maplibre.android.MapLibre;
|
|
13
|
-
import org.maplibre.reactnative.http.CustomHeadersInterceptor;
|
|
14
|
-
|
|
15
|
-
import okhttp3.Dispatcher;
|
|
16
|
-
import okhttp3.OkHttpClient;
|
|
17
|
-
|
|
18
13
|
import org.maplibre.android.module.http.HttpRequestUtil;
|
|
14
|
+
import org.maplibre.reactnative.http.CustomHeadersInterceptor;
|
|
19
15
|
|
|
20
16
|
import java.util.HashMap;
|
|
21
17
|
import java.util.Map;
|
|
22
18
|
|
|
23
19
|
import javax.annotation.Nullable;
|
|
24
20
|
|
|
21
|
+
import okhttp3.Dispatcher;
|
|
22
|
+
import okhttp3.OkHttpClient;
|
|
23
|
+
|
|
25
24
|
@ReactModule(name = MLRNModule.REACT_CLASS)
|
|
26
25
|
public class MLRNModule extends ReactContextBaseJavaModule {
|
|
27
26
|
public static final String REACT_CLASS = "MLRNModule";
|
|
@@ -51,26 +50,10 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
51
50
|
@Override
|
|
52
51
|
@Nullable
|
|
53
52
|
public Map<String, Object> getConstants() {
|
|
54
|
-
// map style urls
|
|
55
53
|
Map<String, String> styleURLS = new HashMap<>();
|
|
56
54
|
styleURLS.put("Default", DEFAULT_STYLE_URL);
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
Map<String, Integer> offlinePackDownloadStates = new HashMap<>();
|
|
60
|
-
offlinePackDownloadStates.put("Inactive", MLRNOfflineModule.INACTIVE_REGION_DOWNLOAD_STATE);
|
|
61
|
-
offlinePackDownloadStates.put("Active", MLRNOfflineModule.ACTIVE_REGION_DOWNLOAD_STATE);
|
|
62
|
-
offlinePackDownloadStates.put("Complete", MLRNOfflineModule.COMPLETE_REGION_DOWNLOAD_STATE);
|
|
63
|
-
|
|
64
|
-
// offline module callback names
|
|
65
|
-
Map<String, String> offlineModuleCallbackNames = new HashMap<>();
|
|
66
|
-
offlineModuleCallbackNames.put("Error", MLRNOfflineModule.OFFLINE_ERROR);
|
|
67
|
-
offlineModuleCallbackNames.put("Progress", MLRNOfflineModule.OFFLINE_PROGRESS);
|
|
68
|
-
|
|
69
|
-
return MapBuilder.<String, Object>builder()
|
|
70
|
-
.put("StyleURL", styleURLS)
|
|
71
|
-
.put("OfflinePackDownloadState", offlinePackDownloadStates)
|
|
72
|
-
.put("OfflineCallbackName", offlineModuleCallbackNames)
|
|
73
|
-
.build();
|
|
56
|
+
return MapBuilder.<String, Object>builder().put("StyleURL", styleURLS).build();
|
|
74
57
|
}
|
|
75
58
|
|
|
76
59
|
@ReactMethod
|
|
@@ -90,8 +73,7 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
90
73
|
public void run() {
|
|
91
74
|
if (!customHeaderInterceptorAdded) {
|
|
92
75
|
Log.i("header", "Add interceptor");
|
|
93
|
-
OkHttpClient httpClient = new OkHttpClient.Builder()
|
|
94
|
-
.addInterceptor(CustomHeadersInterceptor.INSTANCE).dispatcher(getDispatcher()).build();
|
|
76
|
+
OkHttpClient httpClient = new OkHttpClient.Builder().addInterceptor(CustomHeadersInterceptor.INSTANCE).dispatcher(getDispatcher()).build();
|
|
95
77
|
HttpRequestUtil.setOkHttpClient(httpClient);
|
|
96
78
|
customHeaderInterceptorAdded = true;
|
|
97
79
|
}
|