1.0.5 • Published 8 years ago

rmc-gesture v1.0.5

Weekly downloads
17
License
-
Repository
github
Last release
8 years ago

rmc-gesture


React Mobile Component Gesture

NPM version build status Test coverage gemnasium deps node version npm download Sauce Test Status

Sauce Test Status

Screenshots

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: http://react-component.github.io/rmc-gesture/

install

rmc-gesture

Usage

rmc-gesture is a react gesture component for mobile. You can use it as a container, and then it will have some gesture event which you can use.

var MGesture = require('rmc-gesture');
var React = require('react');

function longTap() {
  console.log('longTap');
}

function doubleTap() {
  console.log('doubleTap');
}


React.render(
  <MGesture
    className="container"
    onLongTap={longTap}
    onDoubleTap={doubleTap}
  />,
  container
);

If you just want to use some gesture, not all. You can use the Drag MultipleTap Pinch or Swipe instand of using rmc-gesutre.

import MGesture,
  {MultipleTap, Drag, Swipe, Pinch} from 'rmc-gesture';
var React = require('react');

function longTap() {
  console.log('longTap');
}

function doubleTap() {
  console.log('doubleTap');
}

// only use MultipleTap event
React.render(
  <MultipleTap
    className="container"
    onLongTap={longTap}
    onDoubleTap={doubleTap}
  />,
  container
);

// only use Swipe event
React.render(
  <Swipe
    className="container"
    onSwipe={() => console.log('swipe')}
  />,
  container
);

API

props

属性说明类型默认值
classNameset class nameString''
onLongTaplong tapFunctionfunction() {}
onDoubleTapdouble tapFunctionfunction() {}
onPinchStartstart pinchFunctionfunction() {}
onPinchpinchingFunctionfunction() {}
onPinchInpinch inFunctionfunction() {}
onPinchOutpinch outFunctionfunction() {}
onPinchEndpinch endFunctionfunction() {}
onSwipeswipeFunctionfunction() {}
onSwipeDownswipe downFunctionfunction() {}
onSwipeUpswipe upFunctionfunction() {}
onSwipeRightswipe rightFunctionfunction() {}
onSwipeLeftswipe leftFunctionfunction() {}
onDragStartstart dragFunctionfunction() {}
onDragEnddrag endFunctionfunction() {}
onDragdraggingFunctionfunction() {}

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rmc-gesture is released under the MIT license.