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-touchmap

v1.0.1

Published

Heatmap to track touches in React Native.

Downloads

12

Readme

☝️ react-native-touchmap

Simple, free, and lightweight heatmap component to track touches in your React Native app!

Getting Started

  1. Run npm install react-native-touchmap or yarn add react-native-touchmap to add this dependency to your project.
  2. Wrap your app's root component in the <Touchmap> tag.
  3. Export the output however you want!

The <Touchmap> Component

Below is a complete implementation.

/** Reference variable within your component: */
touchmap:Touchmap = null

/** Inside render(): */
<Touchmap
    style={s.yourStyle}
    debug={true}
    sessionOnly={true}
    ref={r => this.touchmap = r}
>
    ...
</Touchmap>

Props

| | Values | Description | |:-----------:|:---------------:|:----------------------------------------------------------------------------------------------:| | style | {}, [], # | Style of the Touchmap container. | | debug | true/false | Display debugging features such as red border, version number, and 'View' and 'Clear' options? | | sessionOnly | true/false | Export touches for only the current session? | | ref | Touchmap object | Reference available functions raw, clear, and export from a property variable. | | children | nodes | Child nodes of the Touchmap. Usually the root component of the app. |

Ref Functions

clear:()=>void Clears all touches from every session.

raw:()=>Array<TouchSession> Returns a list of TouchSession objects, if you want to parse touches yourself.

export()=>string Returns an encoded string of the image created. This may be used as a uri in an image component or can be handled as an image.

Type Definitions

/** Multiple touch events constituting a session of having the app running. */
export interface TouchSession {
    /** Unique string identifier of the touch session. */
    id: string;
    /** Start time of this session. */
    startTime: Date;
    /** End time of this session. Optional because crashes might not register an end time. */
    endTime?: Date;
    /** An array of touches during this session. */
    touches: Array<TouchMeta>
    /** Size of the device. */
    deviceSize: DeviceSize;
}

/** Single touch event object. */
export interface TouchMeta {
    /** Coordinates of the touch. */
    coordinates: TouchCoordinates;
    /** Start time of this touch. */
    startTime: Date;
    /** End time of this session. Optional because touches may be canceled. */
    endTime?: Date;
    /** Duration of the touch, in milliseconds. */
    duration?: number;
}

/** Simple coordinates interface. */
export interface TouchCoordinates {
    /** x-coordinate of the touch. */
    x: number;
    /** y-coordinate of the touch. */
    y: number;
}

/** Simple device size interface. */
export interface DeviceSize {
    /** Width of the device, in pixels. */
    width: number;
    /** Height of the device, in pixels. */
    height: number;
}

Contributing

If you'd like to improve and/or expand the content of this library, feel free to submit pull requests. If you experience any issues with this code, please let me know promptly.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Vicki Shao for all the support and flames! 🔥