Skip to content

Commit e70ae23

Browse files
committed
add README
1 parent 5afc499 commit e70ae23

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
# react-native-double-click
1+
# react-native-double-click
2+
3+
A Component Wrapper for Double Click/Tap, made for React Native, works on both Android and iOS.
4+
5+
## Running Example
6+
* `git clone https://github.com/dwicao/react-native-double-click.git`
7+
* `cd example`
8+
* `npm install`
9+
* `react-native run-android`
10+
11+
## Installation
12+
* `npm install --save react-native-double-click`
13+
14+
## Usage
15+
```js
16+
import React, { Component } from 'react';
17+
import {
18+
Text,
19+
View,
20+
Alert,
21+
} from 'react-native';
22+
import DoubleClick from 'react-native-double-click';
23+
24+
export default class doubleClicker extends Component {
25+
constructor() {
26+
super();
27+
28+
this.handleClick = this.handleClick.bind(this);
29+
}
30+
31+
handleClick() {
32+
Alert.alert('This is awesome \n Double tap succeed');
33+
}
34+
35+
render() {
36+
return (
37+
<View style={{ flex: 1, marginTop: 50 }}>
38+
<Text style={{ fontSize: 20 }}>
39+
Welcome to React Native!
40+
</Text>
41+
<DoubleClick onClick={this.handleClick}>
42+
<Text style={{ fontSize: 26 }}>
43+
Please tap me twice!
44+
</Text>
45+
</DoubleClick>
46+
</View>
47+
);
48+
}
49+
}
50+
```
51+
52+
## Props
53+
54+
| Property | Type | Default | Description |
55+
| --- | --- | --- | --- |
56+
| delay | number | 300 | (in milliseconds) How fast double click/tap be pressed (number below 200 might not worked) |
57+
| radius | number | 20 | Radius for click/tap |
58+
| onClick | function | () => Alert.alert('Double Tap Succeed') | Execute function after double click/tap be pressed |
59+
60+
## License
61+
MIT
62+

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"android-signkey": "keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000",
2121
"android-release": "cd android && ./gradlew assembleRelease",
2222
"android-signer": "cd android/app/build/outputs/apk/ && jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android app-release-unsigned.apk androiddebugkey",
23-
"android-dev": "source ~/.bashrc && adb uninstall com.splazzz && react-native run-android && adb reverse tcp:8081 tcp:8081 && react-native start",
23+
"android-dev": "source ~/.bashrc && adb uninstall com.doubleClicker && react-native run-android && adb reverse tcp:8081 tcp:8081 && react-native start",
2424
"android-bundle": "react-native bundle --platform android --dev false --entry-file ./index.android.js --bundle-output ./android/app/src/main/assets/index.android.bundle --sourcemap-output ./android/app/src/main/assets/index.android.map --assets-dest ./android/app/src/main/res/"
2525
},
2626
"dependencies": {

0 commit comments

Comments
 (0)