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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-gesture

v0.2.0

Published

composable gesture system in react native

Downloads

344

Readme

React Native Gestures

:warning: This package is still in early stage, it will have a heaps of API changes before it move to 1.0 :warning:

React Native Composable Gesture Library

Build Status npm version npm version Issue Stats Issue Stats js-standard-style

Showcase

Getting Start

Assuming you are using react-native, because I don't know how it will work in other libraries...

  • Install via npm
npm i -S react-native-gestures

Then write some js like the simple code samples as a React component and render it in your react-native app.

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

import {
  drag,
  pinch,
  GestureView
} from 'react-native-gestures';

export default React.createClass({
  render() {
    onGestureError(err) {
      console.error(err);
    },
    return (
      <View>
        <GestureView
          style={movable}
          gestures={[drag, pinch]}
          toStyle={(layout) => {
            return {
              top: layout.y,
              left: layout.x,
              width: layout.width,
              height: layout.height,
              transform: [{rotate: `${layout.rotate}deg`}]
            }
          }}
          onError={console.error.bind(console)}>
          <Text>HEHE</Text>
          <Text>HEHE</Text>
        </GestureView>
      </View>
    );
  }
});

APIs

As you can see, it's just a very simple React component you can use in this package, maybe it will have more components in the future, or not.

There are few properties it accpets:

  • gestures - a Array of gestures
  • onError - a Function will be called when anything bad happens
  • style - a style same as <View>'s style property
  • toStyle - a mapping function that allow you to pick the changes you want to css style
  • children - ... you know, just React children, nothing special

Example:

let style = { position: 'absolute', backgroundColor: '#F00' };

<GestureView
  style={style}
  onError={console.error.bind(console)}
  gestures={[...]}>
  <Text>This is the children I say</Text>
</GestureView>

Gestures

Every gesture in this module is just a simple combination of two things:

  1. A transducer called calculate(please suggest me a better name)

    This is the actual function that calculates the new positions of the view when the move gesture event comes in.

  2. A number called GESTURE_NUMBER

    This define that the gesture will start calculate when the gesture number matches this number.

    You can set any number you want if your touch screen supports it :p

drag

It's just a simple transducer takes one finger input with the move of the finger and generates new layout of the component.

pinch

It's a pinch gesture, also a zoom gesture. It takes two fingers gestures and generates new layout of the component.

Contribute

Using

js-standard-style