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

@cawfree/react-native-heat-map

v0.0.2

Published

A <HeatMap /> Native Module component for React Native.

Downloads

52

Readme

react-native-heat-map

A component for React Native that can be rendered on top or underneath your <View/>s with transparency. If you don't feel like using a native library, you might be interested in react-native-simpleheat.

The native Android solution is implemented using simpleheat as the development reference. On iOS, the heatmap is presented using the performant LFHeatMap as a CocoaPods dependeny. This is not a <MapView/>; but it can be overlaid one.

🚀 Getting started

Using npm:

$ npm install @cawfree/react-native-heat-map --save

Using yarn:

yarn add @cawfree/react-native-heat-map

🤖 Mostly automatic installation

If you're running react-native at any version less than 0.60.0, you'll need to manually link the library to your project:

$ react-native link react-native-heat-map

🔩 Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-heat-map and add HeatMap.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libHeatMap.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import io.github.cawfree.HeatMapPackage; to the imports at the top of the file
  • Add new HeatMapPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-heat-map'
    project(':react-native-heat-map').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-heat-map/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-heat-map')

✍️ Example

There are two main modes the <HeatMap/> can operate in. You can either specify cartesian (2D) co-ordinates:

import HeatMap from 'react-native-heat-map';

export default () => (
  <HeatMap
    pointerEvents="box-only"
    style={{
      flex: 1,
    }}
    data={[
      [
        100, // x
        100, // y
        20   // intensity
      ],
    ]}
  />
);

Alternatively, you can pass a react-native-maps-compatible region prop to process your data through a Web Mercator Projection:

import HeatMap from 'react-native-heat-map';

export default () => (
  <HeatMap
    pointerEvents="box-only"
    style={{
      flex: 1,
    }}
    data={[
      [
        -3.0118499, // longitude
        53.4139281, // latitude
        20   // intensity
      ],
    ]}
    region={{
      longitude: -3.0118499,
      latitude: 53.4139281,
      latitudeDelta: 0.2,
      longitudeDelta: 0.2,
    }}
  />
);

For performance, instead of using setState to update the <HeatMap />, you can choose to setNativeProps directly.

Check out the complete example code.

📌 Props

Prop | Type | Default | Required --------------------- | -------- | ------------------------- | -------- max|number|10|No data|array|[]|No minOpacity|number|0.05|No alpha|number|1.0|No region|shape|null|No

✌️ License

MIT