{"_id":"@alminde/react-native-maps-supercluster","_rev":"2-e2bea3e6987b1130eec02c7a0f0cb1d5","name":"@alminde/react-native-maps-supercluster","dist-tags":{"latest":"1.5.1"},"versions":{"1.5.0":{"name":"@alminde/react-native-maps-supercluster","version":"1.5.0","description":"A clustering-enabled map view for React Native","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/novalabio/react-native-maps-super-cluster.git"},"keywords":["react","react-native","react-component","map","mapview","google-maps","mapkit","supercluster","cluster","clustering"],"author":{"name":"Alberto Dallaporta","email":"alberto.dallaporta@novalab.io","url":"https://www.linkedin.com/in/ad-novalab/"},"contributors":[{"name":"Leonardo Lusoli","email":"leonardo.lusoli@novalab.io","url":"https://www.linkedin.com/in/leonardolusoli/"}],"license":"MIT","bugs":{"url":"https://github.com/novalabio/react-native-maps-super-cluster/issues"},"homepage":"https://github.com/novalabio/react-native-maps-super-cluster#readme","dependencies":{"@mapbox/geo-viewport":"0.4.0","supercluster":"6.0.0"},"peerDependencies":{"prop-types":"15.6.2","react-native-maps":"0.23.0"},"gitHead":"e2c2da6f7dc56077ea6cd12c17a06bedb84246d1","_id":"@alminde/react-native-maps-supercluster@1.5.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Bi9QlGffDpngHRrtAQmIsMII6N4K/HSauFF93cEkhm+KVs1bcgLnFfx5uP6MaSS8XS2C+mV7JIJ/kP85gvOf3w==","shasum":"1289ef821b9f762ac3ea7f5f662b40d0ca6dfab7","tarball":"https://registry.npmjs.org/@alminde/react-native-maps-supercluster/-/react-native-maps-supercluster-1.5.0.tgz","fileCount":8,"unpackedSize":37073,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3ENHCRA9TVsSAnZWagAAbBEP/2EVnSOgmq4pB3jsvP2F\nFfawIuqoIa/pkg7NM3SR2EhV9CQ7uxF5ojHOtnNbR2f+3bLLKBW1m38u++nC\nZpkv83zTGJN9x+GBlkvmxPwrt0M+9Q+dgtT2EeEgAzXoEYxzlrn+rp+wwOEk\nZbCdickpgnW3r59K3gH8YpNGOeWiXNXhn2AovHV4mQi/D59W5VErQ+v/trB8\n/PGrQupouDKIzna1xRex9bUcmMnB7LyhX/7qlHwcxm8+XgbUuLU28dg/i9fy\n2BxskE5gsTx61JKH/YzBKLpGMdPHUaMKrXYE4UqaZ7rDqze6rOqHrA3BR05P\n6nYkHrwAwaeEMiY8DV8RCDXYD5jYSF0u8FiL7i71rcy9jaMPzkLPZwQEQPJC\nYKwEmjC9p1dxpTIq9qHIW7x5uWArJUyo1XkDjMk2+mD5+DPQKABR103j2HbP\n26KrrCFkfnXsd6BQn0jQu30xwyNijETRB2EjYQbP+Hs1Y0RYY74ofNSLishw\n2f6oPNCz5xhrBKELbSVWXTKIQ7k6USLdKHoIYNooocZm3V/+Yrl6c5s9UaRw\n4q5V5AH39+HlxoAQcRO4IniRfS0tKaAhdLY7BbgLYBFlpP+RLS7fx/rEycSG\nt6hqZLZKv77TorD/6BXjrdaZAVGpWMLXdfZNm7gdG5Ah3SnJhvw5FzipGjIT\njMG3\r\n=yGGb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHtKPeALwNv0lAi+Dz6KqE+FJ3jDsv1tY16ZPI86HJMwAiATIIecm/gOJHMunPzIwVZy5MjP6CHxG5dJtD9XGUhong=="}]},"maintainers":[{"name":"alminde","email":"jalminde@me.com"}],"_npmUser":{"name":"alminde","email":"jalminde@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-maps-supercluster_1.5.0_1557939014716_0.38069956216522405"},"_hasShrinkwrap":false},"1.5.1":{"name":"@alminde/react-native-maps-supercluster","version":"1.5.1","description":"A clustering-enabled map view for React Native","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/novalabio/react-native-maps-super-cluster.git"},"keywords":["react","react-native","react-component","map","mapview","google-maps","mapkit","supercluster","cluster","clustering"],"author":{"name":"Alberto Dallaporta","email":"alberto.dallaporta@novalab.io","url":"https://www.linkedin.com/in/ad-novalab/"},"contributors":[{"name":"Leonardo Lusoli","email":"leonardo.lusoli@novalab.io","url":"https://www.linkedin.com/in/leonardolusoli/"}],"license":"MIT","bugs":{"url":"https://github.com/novalabio/react-native-maps-super-cluster/issues"},"homepage":"https://github.com/novalabio/react-native-maps-super-cluster#readme","dependencies":{"@mapbox/geo-viewport":"0.4.0","supercluster":"6.0.0"},"peerDependencies":{"prop-types":"15.6.2","react-native-maps":"0.23.0"},"gitHead":"e2c2da6f7dc56077ea6cd12c17a06bedb84246d1","_id":"@alminde/react-native-maps-supercluster@1.5.1","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-rBOAyq4e8jXrNaIKqCyjzg4qkWjhWH9Q5Ga3QRJvpKllilmLvWqIO7e0KlhwQgB+qjQ10U26wyjpx5y5Nu+/vw==","shasum":"3baa6dc642da1a66eceae3782c4bab98c72ed5e2","tarball":"https://registry.npmjs.org/@alminde/react-native-maps-supercluster/-/react-native-maps-supercluster-1.5.1.tgz","fileCount":8,"unpackedSize":37143,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3sUvCRA9TVsSAnZWagAAFnoP/2HfirfjkFCg8FDUMtn3\n9H88v/vu1uyqV1YJ0eDGXM0InS1U2SbyZZjCjB20Kp4ARtuYjPq6tWJIW2Qj\nCndeybfxzbTgncVOu3iqMCHEOcy6XrRMvYhpUJd8qGsqfIxZMsJUaFDBqd8X\nF+KLKrxqirPlesHeB8NKs9FXon3vAcsS3geDjzU+WevMxVfS2Vle0Eu3YIAO\n/aMoSIb8Rm5d3oKkuOZkgpUjodhHewiHLd3c/fS+FENnXNGAT0eDaNzkCft6\nqyIBKULR2dxRM8S5xiF/Iqjz0+ZjfII0iJaJB5YiGtBBR4FVmxa+1r8LR38+\ndCAg9ggc6Pq9d3/etRKAgSwlB/S4kcRPbmzQiyECEKekZgcCACQDYAWptwse\ntYOaT3hF5hJaBJ4nESSDPyEU1v8XcQkd7c94E3BDaApTTZrm33CIwZ7yGJ/a\nSMwpnGIg3xBS0DS8TdiD1GvPmPM6t25NCz0EI6/5NAK5bA34fc2H5Gf0Q18U\noeTqLkL9fEhw8rivaZexYhA1y5hXp/bSl3pkLonE4Ysgn7zFG10ejca2+1T0\nO47tartFM5GnI6pq2A7Bud45Zur16YbGx1sKZXtK/95hr24sZe8g84FN4Av4\nRins4dJb7SbyGrj0nqlUesaHOfaizml2/Mjcm8AaBlcKND2Vo1M+KhDYaTfA\nEz/f\r\n=xOeG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsXqpCAnb9sCQVIMZp+tLQe/pldto6Q+W9TCchIWp8hwIhAPEBY7kG/t1SBGpQTOJ7dgY6nQ7VKTJV1xVYgTrHmlya"}]},"maintainers":[{"name":"alminde","email":"jalminde@me.com"}],"_npmUser":{"name":"alminde","email":"jalminde@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-maps-supercluster_1.5.1_1558103342767_0.40680338654835935"},"_hasShrinkwrap":false}},"time":{"created":"2019-05-15T16:50:14.677Z","1.5.0":"2019-05-15T16:50:14.830Z","modified":"2022-04-04T13:36:37.472Z","1.5.1":"2019-05-17T14:29:02.884Z"},"maintainers":[{"name":"alminde","email":"jalminde@me.com"}],"description":"A clustering-enabled map view for React Native","homepage":"https://github.com/novalabio/react-native-maps-super-cluster#readme","keywords":["react","react-native","react-component","map","mapview","google-maps","mapkit","supercluster","cluster","clustering"],"repository":{"type":"git","url":"git+https://github.com/novalabio/react-native-maps-super-cluster.git"},"contributors":[{"name":"Leonardo Lusoli","email":"leonardo.lusoli@novalab.io","url":"https://www.linkedin.com/in/leonardolusoli/"}],"author":{"name":"Alberto Dallaporta","email":"alberto.dallaporta@novalab.io","url":"https://www.linkedin.com/in/ad-novalab/"},"bugs":{"url":"https://github.com/novalabio/react-native-maps-super-cluster/issues"},"license":"MIT","readme":"# React Native Super Cluster\nThis module wraps [AirBnB's react-native-maps](https://github.com/airbnb/react-native-maps) and uses [MapBox's SuperCluster](https://github.com/mapbox/supercluster) as clustering engine.\n\n## Example\n\n[See the showcase application](https://github.com/novalabio/react-native-maps-super-cluster-example).\n\n<center>\n<img src=\"https://github.com/novalabio/react-native-maps-super-cluster-example/blob/master/assets/demo.gif?raw=true\" width=\"240\">\n</center>\n\n## Rationale\nThis module wants to provide a stable and performing solution for maps clustering in React Native. In particular, our efforts are focused on integrating SuperCluster methods into React's state/lifecycle events, ensuring stability, compatibility and great performance.\n\n## Install\n`npm i --save react-native-maps-super-cluster`\n\n## Usage\n\n**NOTES:**\n\n* the prop `key` of the markers rendered through `renderMarker` should not be left up to React. Instead, we strongly suggest to use an `id` in order the have unique keys while still taking advantage of React's recycling\n* `ClusteredMapView` supports usual React children. Those children **won't be affected by clustering**, i.e. the behavior for those children is exactly the same as wrapping them around an [AirBnB's react-native-maps](https://github.com/airbnb/react-native-maps) instance\n* Use `onMarkerPress` event on MapView instead of using `onPress` directly on Markers whenever possibile, in particular if you have a lot of pins and clusters. Within `onMarkerPress` you have access to the marker identifier through the `event.nativeEvent` attribute, hence you should be able to do everything you would do within an `onPress` function of a Marker\n\n```JSX\nimport React, { Component } from 'react'\nimport { Marker, Callout } from 'react-native-maps'\nimport ClusteredMapView from 'react-native-maps-super-cluster'\n\nconst INIT_REGION = {\n  latitude: 41.8962667,\n  longitude: 11.3340056,\n  latitudeDelta: 12,\n  longitudeDelta: 12\n}\n\nexport default class MyClusteredMapView extends Component {\n  \n  ...\n\n  renderCluster = (cluster, onPress) => {\n    const pointCount = cluster.pointCount,\n          coordinate = cluster.coordinate,\n          clusterId = cluster.clusterId\n\n    // use pointCount to calculate cluster size scaling\n    // and apply it to \"style\" prop below\n\n    // eventually get clustered points by using\n    // underlying SuperCluster instance\n    // Methods ref: https://github.com/mapbox/supercluster\n    const clusteringEngine = this.map.getClusteringEngine(),\n          clusteredPoints = clusteringEngine.getLeaves(clusterId, 100)\n\n    return (\n      <Marker coordinate={coordinate} onPress={onPress}>\n        <View style={styles.myClusterStyle}>\n          <Text style={styles.myClusterTextStyle}>\n            {pointCount}\n          </Text>\n        </View>\n        {\n          /*\n            Eventually use <Callout /> to\n            show clustered point thumbs, i.e.:\n            <Callout>\n              <ScrollView>\n                {\n                  clusteredPoints.map(p => (\n                    <Image source={p.image}>\n                  ))\n                }\n              </ScrollView>\n            </Callout>\n\n            IMPORTANT: be aware that Marker's onPress event isn't really consistent when using Callout.\n           */\n        }\n      </Marker>\n    )\n  }\n\n  renderMarker = (data) => <Marker key={data.id || Math.random()} coordinate={data.location} />\n\n  ...\n\n  render() {\n    return (\n      <ClusteredMapView\n        style={{flex: 1}}\n        data={this.state.data}\n        initialRegion={INIT_REGION}\n        ref={(r) => { this.map = r }}\n        renderMarker={this.renderMarker}\n        renderCluster={this.renderCluster} />\n    )\n  }\n}\n```\n\n## Props\n\n**Name** | **Type** | **Required** | **Default** | **Note**\n---------|----------|--------------|-------------|---------\nradius | Number | false | window width * 4,5% | [SuperCluster radius](https://github.com/mapbox/supercluster#options).\nextent | Number | false | 512 | [SuperCluster extent](https://github.com/mapbox/supercluster#options).\nminZoom | Number | false | 1 | [SuperCluster minZoom](https://github.com/mapbox/supercluster#options).\nmaxZoom | Number | false | 16 | [SuperCluster maxZoom](https://github.com/mapbox/supercluster#options).\nwidth | Number | false | window width | map's width.\nheight | Number | false | window height | map's height.\ndata | Array <Object> | true | undefined | Objects must have an attribute `location` representing a `GeoPoint`, i.e. `{ latitude: x, longitude: y }`.\nonExplode | Function | false | undefined | TODO\nonImplode | Function | false | undefined | TODO\nonClusterPress(clusterId, ?children) | Function | false |  | Add (or completey override) behaviours to the clusterPress handler. `children` is passed when default behavior is preserved (see `preserveClusterPressBehavior` prop).\npreserveClusterPressBehavior | Bool | false | true | Whether `onClusterPress` prop should completely override module's behavior rather than integrate it.\nclusterPressMaxChildren | Function | false | 100 | Max number of cluster leaves returned as second parameter of `onClusterPress`.\nedgePadding | Object | false | { top: 10, left: 10, bottom: 10, right: 10 } | Edge padding for [react-native-maps's](https://github.com/react-community/react-native-maps/blob/master/docs/mapview.md#methods) `fitToCoordinates` method, called in `onClusterPress` for fitting to pressed cluster children.\nrenderMarker | Function | false | undefined | Must return a react-native-maps' Marker component.\nanimateClusters | Bool | false | true | Animate imploding/exploding of clusters' markers and clusters size change. **Works only on iOS**.\nlayoutAnimationConf | LayoutAnimationConfig | false | `LayoutAnimation.Presets.spring` | Custom Layout animation configuration object for clusters animation during implode / explode **Works only on iOS**.\nclusteringEnabled | Bool | false | true | Dynamically set whether to pass through clustering functions or immediately render markers as a normal mapview.\naccessor | String\\|Func | true | \"location\" | Accessor for item coordinate values. Could be a **string** (field name of an item object with latitude and longitude values) or a **function** (that describes how to access to coordinate data).\n\n## Methods\n**Name** | **Params** | **Description** | **Note**\n---------|------------|-----------------|---------\ngetMapRef | none | Getter for underlying react-native-maps instance | [Official Doc](https://github.com/react-community/react-native-maps#component-api)\ngetClusteringEngine | none | Getter for underlying SuperCluster instance | [Official Doc](https://github.com/mapbox/supercluster)\n\n## Production usage\nIf you are using this module in a production application, please submit a PR or contact us to add it here.\n* [Varee on Google Play](https://play.google.com/store/apps/details?id=com.vareemobile)\n* [Varee on App Store](https://itunes.apple.com/us/app/varee/id1330151010?mt=8)\n* [Our Voice USA on Google Play](https://play.google.com/store/apps/details?id=org.ourvoiceinitiative.ourvoice)\n* [Our Voice USA on App Store](https://itunes.apple.com/us/app/our-voice-usa/id1275301651?ls=1&mt=8)\n* [Metropolíque on Google Play](https://play.google.com/store/apps/details?id=com.metropolique.app)\n* [Metropolíque on App Store](https://itunes.apple.com/us/app/metropolique/id1314473652?ls=1&mt=8)\n* [Outside - Post and do tasks! on Google Play](https://play.google.com/store/apps/details?id=com.outsideapp)\n* [Outside - Post and do tasks! on App Store](https://itunes.apple.com/us/app/outside-post-and-do-tasks/id1444603208?ls=1&mt=8)\n* [Luceverde - ACI Infomobilità on Google Play](https://play.google.com/store/apps/details?id=it.aci.luceverde.client.mobileapp)\n* [Luceverde - ACI Infomobilità on App Store](https://itunes.apple.com/it/app/luceverde/id1357722780?l=en&mt=8)\n\n## TODO\n\n#### features\n* improve `scaleUpRatio` math for fontSize\n* trigger events on cluster implode/explode\n\n# Support\nAs an open source project, we provide free support over Github. However, our daily job may increase response time to days or even weeks. If you need dedicated support, feel free to [contact us](mailto:info@novalab.io) for a quote.\n\n# Contributors\n\n* [Leonardo Lusoli](https://github.com/leolusoli)\n* [Alberto Dallaporta](https://github.com/39otrebla)\n\n# License\nSee [our License](https://github.com/novalabio/react-native-maps-super-cluster/blob/master/LICENSE) for more information.\n","readmeFilename":"README.md"}