1 | # rc-touchable
|
2 | ---
|
3 |
|
4 | react 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
|
31 | import Touchable from 'rc-touchable';
|
32 | ReactDOM.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 | </tbody>
|
80 | </table>
|
81 |
|
82 |
|
83 | ## Development
|
84 |
|
85 | ```
|
86 | npm install
|
87 | npm start
|
88 | ```
|
89 |
|
90 | ## Example
|
91 |
|
92 | http://localhost:8007/examples/
|
93 |
|
94 | online example: http://react-component.github.io/touchable/
|
95 |
|
96 |
|
97 | ## Test Case
|
98 |
|
99 | ```
|
100 | npm test
|
101 | npm run chrome-test
|
102 | ```
|
103 |
|
104 | ## Coverage
|
105 |
|
106 | ```
|
107 | npm run coverage
|
108 | ```
|
109 |
|
110 | open coverage/ dir
|
111 |
|
112 |
|
113 | ## License
|
114 |
|
115 | rc-touchable is released under the MIT license.
|