Skip to content

tiger02/react-touch-component

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-touch-component

NPM Version

基于zepto touch封装的React Component

onTap事件兼容PC使用

Base on zepto touch lib.

onTap event also works with PC as well.

Supported Events

  • onTap
  • onSingleTap
  • onDoubleTap
  • onLongTap
  • onSwipe
  • onSwipeUp
  • onSwipeRight
  • onSwipeDown
  • onSwipeLeft

Installation

$ npm install react-touch-component --save

Usage

import Touch from 'react-touch-component';

export default class Demo extends Component {
  constructor(props, context) {
    super(props, context);
    this.state = {};
    this.handleTap = this.handleTap.bind(this);
  }
  
  handleTap() {
    console.log('tap!');
  }
  
  render() {
    <Touch onTap={this.handleTap}>
      <button>Tap me</button>
    </Touch>
  }
}

Changelog

  • v1.0.0 (2017/2/8) 初版

About

react mobile touch component

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.6%
  • CSS 6.7%
  • HTML 2.7%