@react-native-ohos/react-native-map-clustering 3.5.0 → 4.1.0-beta.1
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 +6 -0
- package/example/package.json +2 -2
- package/lib/ClusteredMapView.js +30 -56
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/example/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"start": "hdc rport tcp:8081 tcp:8081 && react-native start",
|
|
9
9
|
"codegen": "react-native codegen-harmony --rnoh-module-path ./harmony/entry/oh_modules/@rnoh/react-native-openharmony",
|
|
10
10
|
"pack:pkg": "cd ../ && npm pack && cd ./example",
|
|
11
|
-
"install:pkg": "npm uninstall @react-native-ohos/react-native-map-clustering && npm run pack:pkg && npm i @react-native-ohos/react-native-map-clustering@file:../react-native-ohos-react-native-map-clustering-
|
|
11
|
+
"install:pkg": "npm uninstall @react-native-ohos/react-native-map-clustering && npm run pack:pkg && npm i @react-native-ohos/react-native-map-clustering@file:../react-native-ohos-react-native-map-clustering-4.1.0-beta.1.tgz",
|
|
12
12
|
"dev": "npm run codegen && react-native bundle-harmony --dev --minify=false",
|
|
13
13
|
"prod": "npm run codegen && react-native bundle-harmony --dev=false --minify=true",
|
|
14
14
|
"postinstall": "node ./scripts/create-build-profile",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@gorhom/portal": "^1.0.14",
|
|
19
|
-
"@react-native-ohos/react-native-map-clustering": "file:../react-native-ohos-react-native-map-clustering-
|
|
19
|
+
"@react-native-ohos/react-native-map-clustering": "file:../react-native-ohos-react-native-map-clustering-4.1.0-beta.1.tgz",
|
|
20
20
|
"@react-native-ohos/react-native-maps": "file:../packages/react-native-ohos-react-native-maps-1.24.3.tgz",
|
|
21
21
|
"react": "18.3.1",
|
|
22
22
|
"react-native": "0.77.1",
|
package/lib/ClusteredMapView.js
CHANGED
|
@@ -22,28 +22,30 @@ import ClusterHarmony from "./ClusterHarmony";
|
|
|
22
22
|
const ClusteredMapView = forwardRef(
|
|
23
23
|
(
|
|
24
24
|
{
|
|
25
|
-
radius,
|
|
26
|
-
maxZoom,
|
|
27
|
-
minZoom,
|
|
28
|
-
minPoints,
|
|
29
|
-
extent,
|
|
30
|
-
nodeSize,
|
|
25
|
+
radius = Dimensions.get("window").width * 0.06,
|
|
26
|
+
maxZoom = 20,
|
|
27
|
+
minZoom = 1,
|
|
28
|
+
minPoints = 2,
|
|
29
|
+
extent = 512,
|
|
30
|
+
nodeSize = 64,
|
|
31
|
+
edgePadding = { top: 50, left: 50, right: 50, bottom: 50 },
|
|
31
32
|
children,
|
|
32
|
-
onClusterPress,
|
|
33
|
-
onRegionChangeComplete,
|
|
34
|
-
onMarkersChange,
|
|
35
|
-
preserveClusterPressBehavior,
|
|
36
|
-
clusteringEnabled,
|
|
37
|
-
clusterColor,
|
|
38
|
-
clusterTextColor,
|
|
33
|
+
onClusterPress = () => {},
|
|
34
|
+
onRegionChangeComplete = () => {},
|
|
35
|
+
onMarkersChange = () => {},
|
|
36
|
+
preserveClusterPressBehavior = false,
|
|
37
|
+
clusteringEnabled = true,
|
|
38
|
+
clusterColor = "#00B386",
|
|
39
|
+
clusterTextColor = "#FFFFFF",
|
|
39
40
|
clusterFontFamily,
|
|
40
|
-
spiderLineColor,
|
|
41
|
-
layoutAnimationConf,
|
|
42
|
-
animationEnabled,
|
|
41
|
+
spiderLineColor = "#FF0000",
|
|
42
|
+
layoutAnimationConf = LayoutAnimation.Presets.spring,
|
|
43
|
+
animationEnabled = true,
|
|
43
44
|
renderCluster,
|
|
44
|
-
tracksViewChanges,
|
|
45
|
-
spiralEnabled,
|
|
46
|
-
superClusterRef,
|
|
45
|
+
tracksViewChanges = false,
|
|
46
|
+
spiralEnabled = true,
|
|
47
|
+
superClusterRef = {},
|
|
48
|
+
mapRef: mapRefProp = () => {},
|
|
47
49
|
...restProps
|
|
48
50
|
},
|
|
49
51
|
ref
|
|
@@ -130,11 +132,11 @@ const ClusteredMapView = forwardRef(
|
|
|
130
132
|
}
|
|
131
133
|
}, [isSpiderfier, markers]);
|
|
132
134
|
|
|
133
|
-
const _onRegionChangeComplete = (region, harmonyIn) => {
|
|
135
|
+
const _onRegionChangeComplete = (region, details, harmonyIn) => {
|
|
134
136
|
if (Platform.OS === "harmony" && !harmonyIn) {
|
|
135
137
|
region = region.nativeEvent.region;
|
|
136
138
|
setTimeout(() => {
|
|
137
|
-
_onRegionChangeComplete(region, true);
|
|
139
|
+
_onRegionChangeComplete(region, details, true);
|
|
138
140
|
}, 100);
|
|
139
141
|
return;
|
|
140
142
|
}
|
|
@@ -176,17 +178,19 @@ const ClusteredMapView = forwardRef(
|
|
|
176
178
|
if (markers.length != 0) {
|
|
177
179
|
updateMarkers(markers);
|
|
178
180
|
onMarkersChange(markers);
|
|
179
|
-
onRegionChangeComplete
|
|
181
|
+
onRegionChangeComplete &&
|
|
182
|
+
onRegionChangeComplete(region, details, markers);
|
|
180
183
|
updateRegion(region);
|
|
181
184
|
}
|
|
182
185
|
} else {
|
|
183
186
|
updateMarkers(markers);
|
|
184
187
|
onMarkersChange(markers);
|
|
185
|
-
onRegionChangeComplete
|
|
188
|
+
onRegionChangeComplete &&
|
|
189
|
+
onRegionChangeComplete(region, details, markers);
|
|
186
190
|
updateRegion(region);
|
|
187
191
|
}
|
|
188
192
|
} else {
|
|
189
|
-
onRegionChangeComplete(region);
|
|
193
|
+
onRegionChangeComplete && onRegionChangeComplete(region, details);
|
|
190
194
|
}
|
|
191
195
|
};
|
|
192
196
|
|
|
@@ -205,9 +209,7 @@ const ClusteredMapView = forwardRef(
|
|
|
205
209
|
longitude: geometry.coordinates[0],
|
|
206
210
|
}));
|
|
207
211
|
|
|
208
|
-
mapRef.current.fitToCoordinates(coordinates, {
|
|
209
|
-
edgePadding: restProps.edgePadding,
|
|
210
|
-
});
|
|
212
|
+
mapRef.current.fitToCoordinates(coordinates, { edgePadding });
|
|
211
213
|
|
|
212
214
|
onClusterPress(cluster, children);
|
|
213
215
|
};
|
|
@@ -218,7 +220,7 @@ const ClusteredMapView = forwardRef(
|
|
|
218
220
|
ref={(map) => {
|
|
219
221
|
mapRef.current = map;
|
|
220
222
|
if (ref) ref.current = map;
|
|
221
|
-
|
|
223
|
+
mapRefProp(map);
|
|
222
224
|
}}
|
|
223
225
|
onRegionChangeComplete={_onRegionChangeComplete}
|
|
224
226
|
>
|
|
@@ -279,32 +281,4 @@ const ClusteredMapView = forwardRef(
|
|
|
279
281
|
}
|
|
280
282
|
);
|
|
281
283
|
|
|
282
|
-
ClusteredMapView.defaultProps = {
|
|
283
|
-
clusteringEnabled: true,
|
|
284
|
-
spiralEnabled: true,
|
|
285
|
-
animationEnabled: true,
|
|
286
|
-
preserveClusterPressBehavior: false,
|
|
287
|
-
layoutAnimationConf: LayoutAnimation.Presets.spring,
|
|
288
|
-
tracksViewChanges: false,
|
|
289
|
-
// SuperCluster parameters
|
|
290
|
-
radius: Dimensions.get("window").width * 0.06,
|
|
291
|
-
maxZoom: 20,
|
|
292
|
-
minZoom: 1,
|
|
293
|
-
minPoints: 2,
|
|
294
|
-
extent: 512,
|
|
295
|
-
nodeSize: 64,
|
|
296
|
-
// Map parameters
|
|
297
|
-
edgePadding: { top: 50, left: 50, right: 50, bottom: 50 },
|
|
298
|
-
// Cluster styles
|
|
299
|
-
clusterColor: "#00B386",
|
|
300
|
-
clusterTextColor: "#FFFFFF",
|
|
301
|
-
spiderLineColor: "#FF0000",
|
|
302
|
-
// Callbacks
|
|
303
|
-
onRegionChangeComplete: () => {},
|
|
304
|
-
onClusterPress: () => {},
|
|
305
|
-
onMarkersChange: () => {},
|
|
306
|
-
superClusterRef: {},
|
|
307
|
-
mapRef: () => {},
|
|
308
|
-
};
|
|
309
|
-
|
|
310
284
|
export default memo(ClusteredMapView);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"alias": "react-native-map-clustering",
|
|
5
5
|
"redirectInternalImports": true
|
|
6
6
|
},
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "4.1.0-beta.1",
|
|
8
8
|
"description": "React Native Map Clustering both for Android and iOS",
|
|
9
9
|
"types": "index.d.ts",
|
|
10
10
|
"main": "index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"bugs": {
|
|
30
30
|
"url": "https://github.com/react-native-oh-library/react-native-map-clustering/issues"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://github.com/react-native-oh-library/react-native-map-clustering/tree/br_rnoh0.
|
|
32
|
+
"homepage": "https://github.com/react-native-oh-library/react-native-map-clustering/tree/br_rnoh0.82#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"supercluster": "^
|
|
34
|
+
"supercluster": "^8.0.0",
|
|
35
35
|
"@mapbox/geo-viewport": "^0.4.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|