npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-cluster-map

v1.0.9

Published

React Native MapView clustering component for iOS + Android

Downloads

818

Readme

react-native-cluster-map

license Version npm Email

React Native MapView clustering component for iOS + Android


Made by CODEMPIRE

Examples

| Zoom in | Zoom out | | --------------------------------------------------------- | ----------------------------------------------------------------------- | | Example zoom out | Example zoom in | | Cluster Expand | Nested Cluster Expand | | Example cluster expand | Example nested cluster expand |

Installation

  1. Install react-native-maps

  2. Install this component

npm install --save react-native-cluster-map

Usage

import { Marker } from 'react-native-maps';
import { ClusterMap } from 'react-native-cluster-map';

<ClusterMap
  region={{
    latitude: 37.78825,
    longitude: -122.4324,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421,
  }}
>
  <Marker coordinate={{ latitude: 37.78725, longitude: -122.434 }} />
  <Marker coordinate={{ latitude: 37.789, longitude: -122.431 }} />
  <Marker coordinate={{ latitude: 37.78825, longitude: -122.4324 }} />
</ClusterMap>;

Custom Cluster Marker

You can customize cluster marker with renderClusterMarker prop

MyMap.jsx

import { Marker } from "react-native-maps";
import { MyCluster } from "./MyCluster";

// ...

renderCustomClusterMarker = (count) => <MyCluster count={count} />

render () {
  const { markers, region } = this.state;
  return (
    <ClusterMap
      renderClusterMarker={this.renderCustomClusterMarker}
      region={region}
    >
      {markers.map((marker) => (
          <Marker {...marker} />
      ))}
    <ClusterMap>
  )
}

MyCluster.jsx

import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';

export const MyCluster = (props) => {
  const { count } = props;
  return (
    <View style={styles}>
      <Text>{count}</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  width: 50,
  height: 50,
  borderRadius: 25,
  backgroundColor: 'red',
  justifyContent: 'center',
  alignItems: 'center',
});

Result

Custom Marker Example

Props

| Props | Type | Default value | Note | | ------------------------ | ------------ | ----------------------------------------------------- | ---------------------------------------- | | superClusterOptions | Options | { radius: 16, maxZoom: 15, minZoom: 1, nodeSize: 16 } | SuperCluster lib options | | isClusterExpandClick | boolean | true | Enables cluster zoom on click | | region | Region | required | Google Map Region | | priorityMarker | ReactNode | null | Marker which will be outside of clusters | | renderClusterMarker | (object):ReactNode | undefined | Returns cluster marker component | | clusterMarkerProps | object | undefined | Additional ClusterMarker props | | provider | 'google' or null | 'google' | Map provider. If null will use the platform default one (Google Maps for Android and MapKit for iOS) | | style | StyleProp | absoluteFillObject | Styling for MapView |


Children Props

| Props | Type | Default | Note | | ------------------------ | ------------ | ----------------------------------------------------- | ---------------------------------------- | | isOutsideCluster | boolean | false | Prevent child from clusterization. Required for not a Marker children (e.g. Polygon, Polyline, Circle) |


Also contains react-native-maps <MapView /> Props

Events

| Event Name | Returns | Notes | | ------------------ | ---------------------------------------------------------------- | ------------------------------------------------------------------------- | | onClusterClick | ({ clusterId: number, coordinate : LatLng }, children: Marker[]) | Callback that is called when the user pressed on the cluster marker | | onZoomChange | void | Callback that is called with updated map zoom in number |


Also contains react-native-maps <MapView /> Events