xref: /expo/packages/expo-maps/src/Cluster.ts (revision ee0de234)
1import React, { PropsWithChildren } from 'react';
2
3import { BaseMarkerOptions, MarkerObject } from './Marker';
4
5/**
6 * Props of Cluster component of Expo Maps library.
7 */
8export type ClusterProps = PropsWithChildren<
9  {
10    /**
11     * Cluster name
12     *
13     * @required
14     */
15    name: string;
16    /**
17     * Minimal number of markers to form the cluster
18     *
19     * @default 4
20     */
21    minimumClusterSize?: number;
22  } & BaseMarkerOptions
23>;
24
25/**
26 * Internal JSON object for representing marker clusters in Expo Maps library.
27 *
28 * See {@link ClusterProps} for more detail.
29 */
30export type ClusterObject = {
31  type: 'cluster';
32  markers: MarkerObject[];
33  name: string;
34  minimumClusterSize: number;
35} & BaseMarkerOptions;
36
37/**
38 * Cluster component of Expo Maps library.
39 *
40 * Gathers {@link Marker}s passed as this component children in cluster.
41 *
42 * This component should be ExpoMap component child to work properly.
43 *
44 * See {@link ClusterProps} to learn more about props.
45 */
46export class Cluster extends React.Component<ClusterProps> {
47  render() {
48    return null;
49  }
50}
51