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 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-heatmap

v0.0.5

Published

The react-native-heatmap package provides a customizable activity heatmap similar to GitHub's contribution graph, built with react-native-svg.

Downloads

33

Readme

Heatmap Component - NPM Package

Overview

The rn-heatmap package provides a customizable activity heatmap similar to GitHub's contribution graph, built with react-native-svg.

Installation

npm install rn-heatmap

or with Yarn:

yarn add rn-heatmap

Peer Dependencies

Ensure you have react-native-svg installed:

npm install react-native-svg

Usage

Light Mode Component

import React from 'react';
import { View } from 'react-native';
import {Heatmap} from 'rn-heatmap';

const LightModeHeatmap = () => {
  return (
    <View>
      <Heatmap
        year={2024}
        activeDays={[
          {monthIndex: 0, dayIndex: 5, level: 2},
          {monthIndex: 2, dayIndex: 10, level: 3},
          {monthIndex: 5, dayIndex: 20, level: 1},
        ]}
        defaultCellColor="#808080"
        colorMap={{
          1: '#a3d9a5',
          2: '#57c84d',
          3: '#228b22',
        }}
        cellSize={12}
        dayGap={6}
        monthlyGap={30}
        textPadding={10}
        fontWeight="bold"
        getMonthAnnotation={monthIndex =>
          [
            'Jan',
            'Feb',
            'Mar',
            'Apr',
            'May',
            'Jun',
            'Jul',
            'Aug',
            'Sep',
            'Oct',
            'Nov',
            'Dec',
          ][monthIndex]
        }
        showMonthAnnotation={true}
        monthlyAnnotationFontSize={12}
        monthlyAnnotationColor="black"
        cellBorderRadius={4}
        paddingHorizontal={15}
        paddingVertical={5}
        bottomPadding={15}
        showCurrentFullYear={true}
        showScrollBar={true}
      />
    </View>
  );
};

export default LightModeHeatmap;

Alt text


Dark Mode Component

import React from 'react';
import { View } from 'react-native';
import {Heatmap} from 'rn-heatmap';

const DarkModeHeatmap = () => {
  return (
    <View>
      <Heatmap
        year={2024}
        activeDays={[
          {monthIndex: 0, dayIndex: 5, level: 2},
          {monthIndex: 2, dayIndex: 10, level: 3},
          {monthIndex: 5, dayIndex: 20, level: 1},
        ]}
        defaultCellColor="#161b22"
        colorMap={{
          1: '#0e4429',
          2: '#006d32',
          3: '#26a641',
        }}
        cellSize={14}
        dayGap={8}
        monthlyGap={35}
        textPadding={12}
        fontWeight="bold"
        getMonthAnnotation={monthIndex =>
          [
            'Jan',
            'Feb',
            'Mar',
            'Apr',
            'May',
            'Jun',
            'Jul',
            'Aug',
            'Sep',
            'Oct',
            'Nov',
            'Dec',
          ][monthIndex]
        }
        showMonthAnnotation={true}
        monthlyAnnotationFontSize={12}
        monthlyAnnotationColor="white"
        cellBorderRadius={4}
        paddingHorizontal={15}
        paddingVertical={5}
        bottomPadding={15}
        showCurrentFullYear={true}
        showScrollBar={true}
      />
    </View>
  );
};

export default DarkModeHeatmap;

Alt text


API Reference

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | year | number | Required | The year for which the heatmap is generated. | | activeDays | Array<Activity> | [] | List of active days with their month, day index, and activity level. | | defaultCellColor | string | #161b22 | The default background color for inactive days. | | colorMap | {[key: number]: string} | {1: '#0e4429', 2: '#006d32', 3: '#26a641'} | Color mapping for different activity levels. | | cellSize | number | 12 | The size of each cell representing a day. | | dayGap | number | 6 | The gap between each day's cell. | | monthlyGap | number | 30 | The gap between months. | | textPadding | number | 10 | Padding for month annotations. | | fontWeight | FontWeight | 'normal' | Font weight for month labels. | | getMonthAnnotation | (monthIndex: number) => string | getMonthFromMonthIndex | Function to get month labels. | | showMonthAnnotation | boolean | true | Whether to display month labels. | | monthlyAnnotationFontSize | number | 10 | Font size for month labels. | | monthlyAnnotationColor | string | 'white' | Color of month labels. | | cellBorderRadius | number | 2 | Border radius for day cells. | | paddingHorizontal | number | 10 | Horizontal padding for the component. | | paddingVertical | number | 0 | Vertical padding for the component. | | bottomPadding | number | 10 | Bottom padding for the heatmap. | | showCurrentFullYear | boolean | false | Whether to show the entire current year or only past days. | | showScrollBar | boolean | false | Whether to show the horizontal scrollbar. |

Activity Object Structure

Each Activity object in activeDays should have the following structure:

interface Activity {
  monthIndex: number; // 0-based index (0 = January, 11 = December)
  dayIndex: number;   // 0-based index (0 = first day of the month)
  level: 1 | 2 | 3;   // Activity level, corresponding to `colorMap`
}

Contributing

  1. Fork the repository.
  2. Clone the repo: git clone https://github.com/yourusername/rn-heatmap.git
  3. Install dependencies: npm install
  4. Run project by : npm run android or npm run ios etc
  5. Make your changes.
  6. Submit a pull request.

License

MIT License