Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steamerjs/react-touch-component
react mobile touch component
https://github.com/steamerjs/react-touch-component
Last synced: about 1 month ago
JSON representation
react mobile touch component
- Host: GitHub
- URL: https://github.com/steamerjs/react-touch-component
- Owner: steamerjs
- License: mit
- Created: 2016-12-03T12:41:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-27T07:18:32.000Z (almost 7 years ago)
- Last Synced: 2024-10-28T09:22:09.320Z (about 2 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
react-touch-component
==========[![NPM Version](https://img.shields.io/npm/v/react-touch-component.svg?style=flat)](https://www.npmjs.com/package/react-touch-component)
借鉴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
- onSwipeLeftInstallation
----------```
$ npm install react-touch-component --save
```Usage
----------
React 版本```js
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() {
Tap me
}
}
```Preact版本
```js
import Touch from 'react-touch-component/lib/pindex';```
Changelog
----------- `v1.1.4` (2017/12/27) 完善Node环境兼容
- `v1.1.3` (2017/11/11) 完善Node环境兼容
- `v1.1.1` (2017/6/12) 兼容React v15.5后的版本
- `v1.1.0` (2017/2/28) 新增preact版本
- `v1.0.1` (2017/2/22) 兼容Node环境,防止脚本报错
- `v1.0.0` (2017/2/8) 初版