@maplibre/maplibre-react-native 10.0.0-alpha.10 → 10.0.0-alpha.12
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 +13 -0
- package/android/rctmln/.settings/org.eclipse.buildship.core.prefs +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/LocationComponentManager.java +9 -0
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/RCTMLNNativeUserLocation.java +10 -0
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/RCTMLNNativeUserLocationManager.java +5 -0
- package/docs/NativeUserLocation.md +1 -0
- package/docs/UserLocation.md +1 -0
- package/docs/docs.json +14 -0
- package/ios/RCTMLN.xcodeproj/project.pbxproj +2 -2
- package/ios/install.md +4 -4
- package/javascript/components/MarkerView.tsx +10 -9
- package/javascript/components/NativeUserLocation.tsx +4 -0
- package/javascript/components/UserLocation.tsx +8 -0
- package/maplibre-react-native.podspec +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@ PR Title ([#123](link to my pr))
|
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
## 10.0.0-alpha.12
|
|
10
|
+
|
|
11
|
+
Specify in install.md the correct SPM variable name to use a different native iOS library version
|
|
12
|
+
([#438](https://github.com/maplibre/maplibre-react-native/pull/438))
|
|
13
|
+
|
|
14
|
+
Remove deprecated defaultProps for functional component ([#431](https://github.com/maplibre/maplibre-react-native/pull/431))
|
|
15
|
+
|
|
16
|
+
feat: [feat: extract android UserLocation FPS](<[#428](https://github.com/maplibre/maplibre-react-native/pull/428)>)
|
|
17
|
+
|
|
18
|
+
## 10.0.0-alpha.11
|
|
19
|
+
|
|
20
|
+
Chore: [bump maplibre native ios to 6.5.4](https://github.com/maplibre/maplibre-react-native/pull/437)
|
|
21
|
+
|
|
9
22
|
## 10.0.0-alpha.10
|
|
10
23
|
|
|
11
24
|
Fix: [move @types/ packages to deps and remove assets.d.ts #423](https://github.com/maplibre/maplibre-react-native/pull/423)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
connection.project.dir
|
|
1
|
+
connection.project.dir=../../example/android
|
|
2
2
|
eclipse.preferences.version=1
|
|
@@ -67,6 +67,15 @@ public class LocationComponentManager {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
public void setPreferredFramesPerSecond(int preferredFramesPerSecond) {
|
|
71
|
+
if(preferredFramesPerSecond <= 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
mLocationComponent.setMaxAnimationFps(preferredFramesPerSecond);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
70
79
|
public void addOnCameraTrackingChangedListener(OnCameraTrackingChangedListener onCameraTrackingChangedListener) {
|
|
71
80
|
mLocationComponent.addOnCameraTrackingChangedListener(onCameraTrackingChangedListener);
|
|
72
81
|
}
|
|
@@ -17,6 +17,7 @@ public class RCTMLNNativeUserLocation extends AbstractMapFeature implements OnMa
|
|
|
17
17
|
private MapLibreMap mMap;
|
|
18
18
|
private RCTMLNMapView mMapView;
|
|
19
19
|
private @RenderMode.Mode int mRenderMode = RenderMode.COMPASS;
|
|
20
|
+
private int mPreferredFramesPerSecond;
|
|
20
21
|
|
|
21
22
|
public RCTMLNNativeUserLocation(Context context) {
|
|
22
23
|
super(context);
|
|
@@ -28,6 +29,7 @@ public class RCTMLNNativeUserLocation extends AbstractMapFeature implements OnMa
|
|
|
28
29
|
mMapView = mapView;
|
|
29
30
|
mapView.getMapAsync(this);
|
|
30
31
|
setRenderMode(mRenderMode);
|
|
32
|
+
setPreferredFramesPerSecond(mPreferredFramesPerSecond);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
@Override
|
|
@@ -63,4 +65,12 @@ public class RCTMLNNativeUserLocation extends AbstractMapFeature implements OnMa
|
|
|
63
65
|
locationComponent.setRenderMode(renderMode);
|
|
64
66
|
}
|
|
65
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
|
+
}
|
|
66
76
|
}
|
|
@@ -27,6 +27,11 @@ public class RCTMLNNativeUserLocationManager extends ViewGroupManager<RCTMLNNati
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
@ReactProp(name="androidPreferredFramesPerSecond")
|
|
31
|
+
public void setPreferredFramesPerSecond(RCTMLNNativeUserLocation userLocation, int preferredFramesPerSecond) {
|
|
32
|
+
userLocation.setPreferredFramesPerSecond(preferredFramesPerSecond);
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
@Nonnull
|
|
31
36
|
@Override
|
|
32
37
|
protected RCTMLNNativeUserLocation createViewInstance(@Nonnull ThemedReactContext reactContext) {
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| androidRenderMode | `"normal" \| "compass" \| "gps"` | `none` | `false` | Android render mode.<br/><br/> - normal: just a circle<br/> - compass: triangle with heading<br/> - gps: large arrow<br/><br/>@platform android |
|
|
9
9
|
| iosShowsUserHeadingIndicator | `boolean` | `none` | `false` | iOS only. A Boolean value indicating whether the user location annotation may display a permanent heading indicator.<br/><br/>@platform ios |
|
|
10
|
+
| androidPreferredFramesPerSecond | `number` | `none` | `false` | Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX. |
|
|
10
11
|
|
|
11
12
|
|
package/docs/UserLocation.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
| visible | `boolean` | `true` | `false` | Whether location icon is visible |
|
|
12
12
|
| showsUserHeadingIndicator | `boolean` | `false` | `false` | Show or hide small arrow which indicates direction the device is pointing relative to north. |
|
|
13
13
|
| minDisplacement | `number` | `0` | `false` | Minimum amount of movement before GPS location is updated in meters |
|
|
14
|
+
| androidPreferredFramesPerSecond | `number` | `none` | `false` | Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.<br/><br/>@platform android |
|
|
14
15
|
| children | `ReactElement \| ReactElement[]` | `none` | `false` | Custom location icon of type mapbox-gl-native components<br/><br/>NOTE: Forking maintainer does not understand the above comment. |
|
|
15
16
|
|
|
16
17
|
### methods
|
package/docs/docs.json
CHANGED
|
@@ -2659,6 +2659,13 @@
|
|
|
2659
2659
|
"type": "boolean",
|
|
2660
2660
|
"default": "none",
|
|
2661
2661
|
"description": "iOS only. A Boolean value indicating whether the user location annotation may display a permanent heading indicator.\n\n@platform ios"
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
"name": "androidPreferredFramesPerSecond",
|
|
2665
|
+
"required": false,
|
|
2666
|
+
"type": "number",
|
|
2667
|
+
"default": "none",
|
|
2668
|
+
"description": "Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX."
|
|
2662
2669
|
}
|
|
2663
2670
|
],
|
|
2664
2671
|
"fileNameWithExt": "NativeUserLocation.tsx",
|
|
@@ -4843,6 +4850,13 @@
|
|
|
4843
4850
|
"default": "0",
|
|
4844
4851
|
"description": "Minimum amount of movement before GPS location is updated in meters"
|
|
4845
4852
|
},
|
|
4853
|
+
{
|
|
4854
|
+
"name": "androidPreferredFramesPerSecond",
|
|
4855
|
+
"required": false,
|
|
4856
|
+
"type": "number",
|
|
4857
|
+
"default": "none",
|
|
4858
|
+
"description": "Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.\n\n@platform android"
|
|
4859
|
+
},
|
|
4846
4860
|
{
|
|
4847
4861
|
"name": "children",
|
|
4848
4862
|
"required": false,
|
|
@@ -676,7 +676,7 @@
|
|
|
676
676
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
677
677
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
678
678
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React";
|
|
679
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
679
|
+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
|
680
680
|
MTL_ENABLE_DEBUG_INFO = YES;
|
|
681
681
|
ONLY_ACTIVE_ARCH = YES;
|
|
682
682
|
SDKROOT = iphoneos;
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
720
720
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
721
721
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React";
|
|
722
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
722
|
+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
|
723
723
|
MTL_ENABLE_DEBUG_INFO = NO;
|
|
724
724
|
SDKROOT = iphoneos;
|
|
725
725
|
VALIDATE_PRODUCT = YES;
|
package/ios/install.md
CHANGED
|
@@ -12,7 +12,7 @@ Add the following to your `ios/Podfile`:
|
|
|
12
12
|
end
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Running `pod install` will add version `6.4
|
|
15
|
+
Running `pod install` will add version `6.5.4` of the MapLibre SDK.
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
# Go to the ios directory
|
|
@@ -33,16 +33,16 @@ until this is fixed upstream. iOS devs can open the workspace in Xcode and run f
|
|
|
33
33
|
|
|
34
34
|
## Installing a specific version
|
|
35
35
|
|
|
36
|
-
The current default MapLibre version is `6.4
|
|
36
|
+
The current default MapLibre version is `6.5.4`.
|
|
37
37
|
If you want to install a different version, you can override as follows in
|
|
38
38
|
your `Podfile`:
|
|
39
39
|
|
|
40
40
|
```ruby
|
|
41
|
-
$
|
|
41
|
+
$RCTMLN_SPM_Spec = {
|
|
42
42
|
url: "https://github.com/maplibre/maplibre-gl-native-distribution",
|
|
43
43
|
requirement: {
|
|
44
44
|
kind: "upToNextMajorVersion",
|
|
45
|
-
minimumVersion: "6.4
|
|
45
|
+
minimumVersion: "6.5.4"
|
|
46
46
|
},
|
|
47
47
|
product_name: "MapLibre"
|
|
48
48
|
}
|
|
@@ -53,14 +53,20 @@ interface NativeProps extends ViewProps {
|
|
|
53
53
|
* This is based on [MakerView plugin](https://docs.mapbox.com/android/plugins/overview/markerview/) on Android
|
|
54
54
|
* and PointAnnotation on iOS.
|
|
55
55
|
*/
|
|
56
|
-
const MarkerView = (
|
|
56
|
+
const MarkerView = ({
|
|
57
|
+
anchor = { x: 0.5, y: 0.5 },
|
|
58
|
+
allowOverlap = false,
|
|
59
|
+
isSelected = false,
|
|
60
|
+
...rest
|
|
61
|
+
}: MarkerViewProps): ReactElement => {
|
|
62
|
+
const props = { anchor, allowOverlap, isSelected, ...rest };
|
|
57
63
|
const coordinate = props.coordinate
|
|
58
64
|
? toJSONString(makePoint(props.coordinate))
|
|
59
65
|
: undefined;
|
|
60
66
|
|
|
61
67
|
const idForPointAnnotation = useMemo(() => {
|
|
62
|
-
|
|
63
|
-
return `MV-${
|
|
68
|
+
lastId = lastId + 1;
|
|
69
|
+
return `MV-${lastId}`;
|
|
64
70
|
}, []);
|
|
65
71
|
|
|
66
72
|
if (Platform.OS === "ios") {
|
|
@@ -75,12 +81,7 @@ const MarkerView = (props: MarkerViewProps): ReactElement => {
|
|
|
75
81
|
return <RCTMLNMarkerView {...propsToSend}>{props.children}</RCTMLNMarkerView>;
|
|
76
82
|
};
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
MarkerView.defaultProps = {
|
|
80
|
-
anchor: { x: 0.5, y: 0.5 },
|
|
81
|
-
allowOverlap: false,
|
|
82
|
-
isSelected: false,
|
|
83
|
-
};
|
|
84
|
+
let lastId = 0;
|
|
84
85
|
|
|
85
86
|
const RCTMLNMarkerView =
|
|
86
87
|
requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
@@ -20,6 +20,10 @@ interface NativeUserLocationProps {
|
|
|
20
20
|
* @platform ios
|
|
21
21
|
*/
|
|
22
22
|
iosShowsUserHeadingIndicator?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.
|
|
25
|
+
*/
|
|
26
|
+
androidPreferredFramesPerSecond?: number;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
const NativeUserLocation = (props: NativeUserLocationProps): ReactElement => {
|
|
@@ -93,6 +93,12 @@ interface UserLocationProps {
|
|
|
93
93
|
* Minimum amount of movement before GPS location is updated in meters
|
|
94
94
|
*/
|
|
95
95
|
minDisplacement?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Android only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.
|
|
98
|
+
*
|
|
99
|
+
* @platform android
|
|
100
|
+
*/
|
|
101
|
+
androidPreferredFramesPerSecond?: number;
|
|
96
102
|
/**
|
|
97
103
|
* Custom location icon of type mapbox-gl-native components
|
|
98
104
|
*
|
|
@@ -128,6 +134,7 @@ const UserLocation = React.memo(
|
|
|
128
134
|
minDisplacement = 0,
|
|
129
135
|
renderMode = "normal",
|
|
130
136
|
androidRenderMode,
|
|
137
|
+
androidPreferredFramesPerSecond,
|
|
131
138
|
children,
|
|
132
139
|
onUpdate,
|
|
133
140
|
onPress,
|
|
@@ -259,6 +266,7 @@ const UserLocation = React.memo(
|
|
|
259
266
|
const props = {
|
|
260
267
|
androidRenderMode,
|
|
261
268
|
iosShowsUserHeadingIndicator: showsUserHeadingIndicator,
|
|
269
|
+
androidPreferredFramesPerSecond,
|
|
262
270
|
};
|
|
263
271
|
|
|
264
272
|
return <NativeUserLocation {...props} />;
|
package/package.json
CHANGED