@maplibre/maplibre-react-native 10.0.0-alpha.23 → 10.0.0-alpha.24

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/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ PR Title ([#123](link to my pr))
6
6
 
7
7
  ```
8
8
 
9
+ ## 10.0.0-alpha.24
10
+
11
+ feat: support new arch through interop layer ([#483](https://github.com/maplibre/maplibre-react-native/pull/483))
12
+
9
13
  ## 10.0.0-alpha.23
10
14
 
11
15
  fix: keep @ts-ignore for headingIcon in library ([#477](https://github.com/maplibre/maplibre-react-native/pull/477))
@@ -4,6 +4,10 @@ def safeExtGet(prop, fallback) {
4
4
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5
5
  }
6
6
 
7
+ def isNewArchitectureEnabled() {
8
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
9
+ }
10
+
7
11
  android {
8
12
  compileSdkVersion safeExtGet("compileSdkVersion", 33)
9
13
  buildToolsVersion safeExtGet("buildToolsVersion", '33.0.1')
@@ -13,6 +17,7 @@ android {
13
17
  targetSdkVersion safeExtGet('targetSdkVersion', 26)
14
18
  versionCode 1
15
19
  versionName "1.0"
20
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
16
21
  }
17
22
 
18
23
  compileOptions {
@@ -2,12 +2,16 @@ package com.maplibre.rctmln.components;
2
2
 
3
3
  import android.view.ViewGroup;
4
4
 
5
+ import com.maplibre.rctmln.BuildConfig;
5
6
  import com.facebook.react.bridge.ReactApplicationContext;
6
7
  import com.facebook.react.common.MapBuilder;
7
8
  import com.facebook.react.uimanager.ThemedReactContext;
9
+ import com.facebook.react.uimanager.UIManagerHelper;
8
10
  import com.facebook.react.uimanager.UIManagerModule;
9
11
  import com.facebook.react.uimanager.ViewGroupManager;
10
12
  import com.facebook.react.uimanager.events.EventDispatcher;
13
+ import com.facebook.react.uimanager.common.UIManagerType;
14
+
11
15
  import com.maplibre.rctmln.events.IEvent;
12
16
 
13
17
  import java.util.HashMap;
@@ -45,7 +49,11 @@ abstract public class AbstractEventEmitter<T extends ViewGroup> extends ViewGrou
45
49
 
46
50
  @Override
47
51
  protected void addEventEmitters(ThemedReactContext context, @Nonnull T view) {
48
- mEventDispatcher = context.getNativeModule(UIManagerModule.class).getEventDispatcher();
52
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
53
+ mEventDispatcher = UIManagerHelper.getUIManager(context, UIManagerType.FABRIC).getEventDispatcher();
54
+ } else {
55
+ mEventDispatcher = context.getNativeModule(UIManagerModule.class).getEventDispatcher();
56
+ }
49
57
  }
50
58
 
51
59
  @Nullable
@@ -18,7 +18,7 @@ import com.maplibre.rctmln.location.LocationManager;
18
18
 
19
19
  @ReactModule(name = RCTMLNLocationModule.REACT_CLASS)
20
20
  public class RCTMLNLocationModule extends ReactContextBaseJavaModule {
21
- public static final String REACT_CLASS = "RCTMLNLocationModule";
21
+ public static final String REACT_CLASS = "MLNLocationModule";
22
22
  public static final String LOCATION_UPDATE = "MapboxUserLocationUpdate";
23
23
 
24
24
  private boolean isEnabled;
@@ -13,7 +13,7 @@ import android.util.Log;
13
13
 
14
14
  @ReactModule(name = RCTMLNLogging.REACT_CLASS)
15
15
  public class RCTMLNLogging extends ReactContextBaseJavaModule {
16
- public static final String REACT_CLASS = "RCTMLNLogging";
16
+ public static final String REACT_CLASS = "MLNLogging";
17
17
  private ReactApplicationContext mReactContext;
18
18
 
19
19
  public RCTMLNLogging(ReactApplicationContext reactApplicationContext) {
@@ -36,7 +36,7 @@ import javax.annotation.Nullable;
36
36
 
37
37
  @ReactModule(name = RCTMLNModule.REACT_CLASS)
38
38
  public class RCTMLNModule extends ReactContextBaseJavaModule {
39
- public static final String REACT_CLASS = "RCTMLNModule";
39
+ public static final String REACT_CLASS = "MLNModule";
40
40
 
41
41
  private static boolean customHeaderInterceptorAdded = false;
42
42
 
@@ -38,7 +38,7 @@ import java.util.Locale;
38
38
 
39
39
  @ReactModule(name = RCTMLNOfflineModule.REACT_CLASS)
40
40
  public class RCTMLNOfflineModule extends ReactContextBaseJavaModule {
41
- public static final String REACT_CLASS = "RCTMLNOfflineModule";
41
+ public static final String REACT_CLASS = "MLNOfflineModule";
42
42
 
43
43
  public static final int INACTIVE_REGION_DOWNLOAD_STATE = OfflineRegion.STATE_INACTIVE;
44
44
  public static final int ACTIVE_REGION_DOWNLOAD_STATE = OfflineRegion.STATE_ACTIVE;
@@ -40,7 +40,7 @@ import static android.content.Context.CONTEXT_IGNORE_SECURITY;
40
40
 
41
41
  @ReactModule(name = RCTMLNSnapshotModule.REACT_CLASS)
42
42
  public class RCTMLNSnapshotModule extends ReactContextBaseJavaModule {
43
- public static final String REACT_CLASS = "RCTMLNSnapshotModule";
43
+ public static final String REACT_CLASS = "MLNSnapshotModule";
44
44
 
45
45
  private ReactApplicationContext mContext;
46
46
 
package/docs/MapView.md CHANGED
@@ -16,16 +16,10 @@
16
16
  | pitchEnabled | `boolean` | `true` | `false` | Enable/Disable pitch on map |
17
17
  | rotateEnabled | `boolean` | `true` | `false` | Enable/Disable rotation on map |
18
18
  | attributionEnabled | `boolean` | `true` | `false` | Enable/Disable attribution on map.<br/><br/>This must be enabled for Mapbox-hosted tiles and styles. Please refer to the Mapbox Terms of Service.<br/>Other providers do not require this. |
19
- | attributionPosition | `\| { top?: number; left?: number }
20
- \| { top?: number; right?: number }
21
- \| { bottom?: number; left?: number }
22
- \| { bottom?: number; right?: number }` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
19
+ | attributionPosition | `{ top?: number; left?: number } \| { top?: number; right?: number } \| { bottom?: number; left?: number } \| { bottom?: number; right?: number }` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
23
20
  | tintColor | `string \| unknown[]` | `none` | `false` | MapView's tintColor |
24
21
  | logoEnabled | `boolean` | `false` | `false` | Enable/Disable the logo on the map. |
25
- | logoPosition | `\| { top?: number; left?: number }
26
- \| { top?: number; right?: number }
27
- \| { bottom?: number; left?: number }
28
- \| { bottom?: number; right?: number }` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
22
+ | logoPosition | `{ top?: number; left?: number } \| { top?: number; right?: number } \| { bottom?: number; left?: number } \| { bottom?: number; right?: number }` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
29
23
  | compassEnabled | `boolean` | `none` | `false` | Enable/Disable the compass from appearing on the map |
30
24
  | compassViewPosition | `number` | `none` | `false` | Change corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight |
31
25
  | compassViewMargins | `object` | `none` | `false` | Add margins to the compass with x and y values |
@@ -7,10 +7,7 @@
7
7
  | ---- | :--: | :-----: | :------: | :----------: |
8
8
  | id | `string` | `MapLibreGL.StyleSource.DefaultSourceID` | `false` | A string that uniquely identifies the source. |
9
9
  | url | `string` | `none` | `false` | An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle. |
10
- | shape | `\| GeoJSON.GeometryCollection
11
- \| GeoJSON.Feature
12
- \| GeoJSON.FeatureCollection
13
- \| GeoJSON.Geometry` | `none` | `false` | The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature colllection. |
10
+ | shape | `GeoJSON.GeometryCollection \| GeoJSON.Feature \| GeoJSON.FeatureCollection \| GeoJSON.Geometry` | `none` | `false` | The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature colllection. |
14
11
  | cluster | `boolean` | `none` | `false` | Enables clustering on the source for point shapes. |
15
12
  | clusterRadius | `number` | `none` | `false` | Specifies the radius of each cluster if clustering is enabled.<br/>A value of 512 produces a radius equal to the width of a tile.<br/>The default value is 50. |
16
13
  | clusterMaxZoomLevel | `number` | `none` | `false` | Specifies the maximum zoom level at which to cluster points if clustering is enabled.<br/>Defaults to one zoom level less than the value of maxZoomLevel so that, at the maximum zoom level,<br/>the shapes are not clustered. |
@@ -24,7 +24,7 @@ interface IMLNModule {
24
24
  setConnected(connected: boolean): void;
25
25
  }
26
26
 
27
- const MLNModule: IMLNModule = { ...NativeModules.MLNModule };
27
+ const MLNModule: IMLNModule = Object.create(NativeModules.MLNModule);
28
28
 
29
29
  export const {
30
30
  StyleURL,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maplibre/maplibre-react-native",
3
3
  "description": "React Native library for creating maps with MapLibre Native for Android & iOS",
4
- "version": "10.0.0-alpha.23",
4
+ "version": "10.0.0-alpha.24",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -63,7 +63,7 @@
63
63
  "@babel/eslint-parser": "^7.22.9",
64
64
  "@babel/plugin-proposal-class-properties": "7.18.6",
65
65
  "@babel/runtime": "7.17.2",
66
- "@expo/config-plugins": "^7.2.5",
66
+ "@expo/config-plugins": "^8.0.10",
67
67
  "@react-native/babel-preset": "^0.74.88",
68
68
  "@react-native/metro-config": "^0.74.88",
69
69
  "@sinonjs/fake-timers": "^11.2.2",
@@ -451,7 +451,7 @@ function _propMarkdownTableRows(props, prefix = "") {
451
451
  const { description = "" } = prop;
452
452
  let result = `| ${prefix}${
453
453
  prop.name
454
- } | \`${type}\` | \`${defaultValue}\` | \`${
454
+ } | \`${type.replace(/^\\\| /, "").replace(/\n/g, " ")}\` | \`${defaultValue}\` | \`${
455
455
  prop.required
456
456
  }\` | ${replaceNewLine(description)} |`;
457
457
  if (type === "shape") {