Giter Site home page Giter Site logo

mohamed-amin / hammer.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from longseespace/hammer.js

0.0 2.0 0.0 9.67 MB

This is a port of Hammer.JS for React Native.

License: MIT License

JavaScript 94.52% CoffeeScript 0.46% CSS 0.73% HTML 4.30%

hammer.js's Introduction

React Native Hammer.JS

This is a port of Hammer.JS for React Native.

  • ReactNative: peerDependencies 0.17.x
  • HammerJS: 2.0.4

Usage

import ...

import { Hammer, addGestureRecognizer } from 'react-native-hammerjs';

class YourComponent extends React.Component {
  constructor(props: any) {
    super(props);

    const mc = this.props.hammer;

    const pan = new Hammer.Pan({ direction: Hammer.DIRECTION_ALL, threshold: 0 });
    mc.add(pan);

    mc.on('pan', (e) => {
      console.log('pan', e);
    });
  }

  render() {
    return (
      <View {...this.props.handlers}>
      </View>
    );
  }
}

export default addGestureRecognizer(YourComponent);

This module exposes:

  1. Hammer: Hammer class as in HammerJS
  2. GestureRecognizer: Class GestureRecognizer
  3. addGestureRecognizer: A function that create a Higher Order Component that wraps YourComponent and passes props handlers (GestureRecognizer handlers)

Visit hammerjs.github.io for documentation.

hammer.js's People

Contributors

jtangelder avatar erwinelling avatar ppcano avatar aratramba avatar michaelpaulson-wf avatar lloiser avatar stereobit avatar danielgruber avatar phated avatar longseespace avatar visiongeist avatar bumbu avatar annam avatar sithmel avatar adamdorwart avatar sedovsek avatar inorganik avatar seutje avatar stefhatcher avatar robharper avatar lucasgunn avatar jantimon avatar jaap3 avatar fnd avatar duncaen avatar brandonhenricks avatar arschmitz avatar klundberg avatar majestic2k avatar denchev avatar

Watchers

James Cloos avatar Amin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.