>;
11 | mapDimensions: MapDimensions;
12 | region: Region;
13 | renderItem: (
14 | item: Supercluster.PointOrClusterFeature,
15 | index: number,
16 | array: Supercluster.PointOrClusterFeature
[]
17 | ) => React.ReactElement;
18 | options?: Supercluster.Options
;
19 | }
20 |
21 | export function Clusterer<
22 | P extends Supercluster.AnyProps,
23 | C extends Supercluster.AnyProps,
24 | >({
25 | data,
26 | options,
27 | region,
28 | mapDimensions,
29 | renderItem,
30 | }: ClustererProps
): ReactElement {
31 | const [points] = useClusterer(data, mapDimensions, region, options);
32 |
33 | return <>{points.map(renderItem)}>;
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Jiri Hoffmann
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | SOFTWARE.
21 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/ClustererExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "globalDependencies": [".nvmrc", ".yarnrc.yml"],
4 | "globalEnv": ["NODE_ENV"],
5 | "tasks": {
6 | "build:android": {
7 | "env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"],
8 | "inputs": [
9 | "package.json",
10 | "android",
11 | "!android/build",
12 | "src/*.ts",
13 | "src/*.tsx",
14 | "example/package.json",
15 | "example/android",
16 | "!example/android/.gradle",
17 | "!example/android/build",
18 | "!example/android/app/build"
19 | ],
20 | "outputs": []
21 | },
22 | "build:ios": {
23 | "env": [
24 | "RCT_NEW_ARCH_ENABLED",
25 | "RCT_USE_RN_DEP",
26 | "RCT_USE_PREBUILT_RNCORE"
27 | ],
28 | "inputs": [
29 | "package.json",
30 | "*.podspec",
31 | "ios",
32 | "src/*.ts",
33 | "src/*.tsx",
34 | "example/package.json",
35 | "example/ios",
36 | "!example/ios/build",
37 | "!example/ios/Pods"
38 | ],
39 | "outputs": []
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/nitrogen/generated/ios/ClustererAutolinking.mm:
--------------------------------------------------------------------------------
1 | ///
2 | /// ClustererAutolinking.mm
3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4 | /// https://github.com/mrousavy/nitro
5 | /// Copyright © 2025 Marc Rousavy @ Margelo
6 | ///
7 |
8 | #import
9 | #import
10 |
11 | #import
12 |
13 | #include "HybridClusterer.hpp"
14 |
15 | @interface ClustererAutolinking : NSObject
16 | @end
17 |
18 | @implementation ClustererAutolinking
19 |
20 | + (void) load {
21 | using namespace margelo::nitro;
22 | using namespace margelo::nitro::clusterer;
23 |
24 | HybridObjectRegistry::registerHybridObjectConstructor(
25 | "Clusterer",
26 | []() -> std::shared_ptr {
27 | static_assert(std::is_default_constructible_v,
28 | "The HybridObject \"HybridClusterer\" is not default-constructible! "
29 | "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
30 | return std::make_shared();
31 | }
32 | );
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/example/ios/ClustererExample/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyAccessedAPITypes
6 |
7 |
8 | NSPrivacyAccessedAPIType
9 | NSPrivacyAccessedAPICategoryFileTimestamp
10 | NSPrivacyAccessedAPITypeReasons
11 |
12 | C617.1
13 |
14 |
15 |
16 | NSPrivacyAccessedAPIType
17 | NSPrivacyAccessedAPICategoryUserDefaults
18 | NSPrivacyAccessedAPITypeReasons
19 |
20 | CA92.1
21 |
22 |
23 |
24 | NSPrivacyAccessedAPIType
25 | NSPrivacyAccessedAPICategorySystemBootTime
26 | NSPrivacyAccessedAPITypeReasons
27 |
28 | 35F9.1
29 |
30 |
31 |
32 | NSPrivacyCollectedDataTypes
33 |
34 | NSPrivacyTracking
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/cpp/clustererJSIHelpers.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include