UNPKG

2.98 kBMarkdownView Raw
1# rc-touchable
2---
3
4react touchable component. inspired by react-native.
5
6[![NPM version][npm-image]][npm-url]
7[![build status][travis-image]][travis-url]
8[![Test coverage][coveralls-image]][coveralls-url]
9[![npm download][download-image]][download-url]
10
11[npm-image]: http://img.shields.io/npm/v/rc-touchable.svg?style=flat-square
12[npm-url]: http://npmjs.org/package/rc-touchable
13[travis-image]: https://img.shields.io/travis/react-component/touchable.svg?style=flat-square
14[travis-url]: https://travis-ci.org/react-component/touchable
15[coveralls-image]: https://img.shields.io/coveralls/react-component/touchable.svg?style=flat-square
16[coveralls-url]: https://coveralls.io/r/react-component/touchable?branch=master
17[gemnasium-image]: http://img.shields.io/gemnasium/react-component/touchable.svg?style=flat-square
18[gemnasium-url]: https://gemnasium.com/react-component/touchable
19[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
20[node-url]: http://nodejs.org/download/
21[download-image]: https://img.shields.io/npm/dm/rc-touchable.svg?style=flat-square
22[download-url]: https://npmjs.org/package/rc-touchable
23
24## Install
25
26[![rc-touchable](https://nodei.co/npm/rc-touchable.png)](https://npmjs.org/package/rc-touchable)
27
28## Usage
29
30```js
31import Touchable from 'rc-touchable';
32ReactDOM.render(<Touchable onPress={onPress} activeClassName="active">
33<div>click</div>
34</Touchable>, container);
35```
36
37## API
38
39<table class="table table-bordered table-striped">
40 <thead>
41 <tr>
42 <th style="width: 100px;">name</th>
43 <th style="width: 50px;">type</th>
44 <th style="width: 50px;">default</th>
45 <th>description</th>
46 </tr>
47 </thead>
48 <tbody>
49 <tr>
50 <td>disabled</td>
51 <td>boolean</td>
52 <td>false</td>
53 <td></td>
54 </tr>
55 <tr>
56 <td>onPress</td>
57 <td>()=>void</td>
58 <td></td>
59 <td>onPress/onTap callback</td>
60 </tr>
61 <tr>
62 <td>onLongPress</td>
63 <td>()=>void</td>
64 <td></td>
65 <td>onLongPress/onLongTap callback</td>
66 </tr>
67 <tr>
68 <td>activeClassName</td>
69 <td>string</td>
70 <td></td>
71 <td>className applied to child when active</td>
72 </tr>
73 <tr>
74 <td>activeStyle</td>
75 <td>object</td>
76 <td></td>
77 <td>style applied to child when active</td>
78 </tr>
79 <tr>
80 <td>activeStopPropagation</td>
81 <td>object</td>
82 <td></td>
83 <td>stop child active propagate to parent</td>
84 </tr>
85 </tbody>
86</table>
87
88
89## Development
90
91```
92npm install
93npm start
94```
95
96## Example
97
98http://localhost:8007/examples/
99
100online example: http://react-component.github.io/touchable/
101
102
103## Test Case
104
105```
106npm test
107npm run chrome-test
108```
109
110## Coverage
111
112```
113npm run coverage
114```
115
116open coverage/ dir
117
118
119## License
120
121rc-touchable is released under the MIT license.