Skip to content

Commit 3e339f2

Browse files
committed
readme/doc
1 parent fb3744d commit 3e339f2

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
[](#installation)
6767

6868
## Installation
69+
6970
Run the following command from the root of your project:
7071

7172
`ns plugin add @nativescript-community/gesturehandler`
@@ -79,16 +80,18 @@ Run the following command from the root of your project:
7980
## API
8081

8182
We need to do some wiring when your app starts, so open `app.ts` and add this before creating any View/App/Frame:
83+
8284
##### TypeScript
85+
8386
```ts
84-
import { install } from "@nativescript-community/gesturehandler";
87+
import { install } from '@nativescript-community/gesturehandler';
8588
install();
8689
```
8790

8891
You create a gesture handler using something like this:
89-
```typescript
90-
import { GestureHandlerTouchEvent, GestureHandlerStateEvent, GestureStateEventData, GestureTouchEventData, HandlerType } from '@nativescript-community/gesturehandler';
9192

93+
```typescript
94+
import { GestureHandlerTouchEvent, GestureHandlerStateEvent, GestureStateEventData, GestureTouchEventData, HandlerType, Manager } from '@nativescript-community/gesturehandler';
9295

9396
function onGestureTouch(args: GestureTouchEventData) {
9497
const { state, extraData, view } = args.data;
@@ -100,17 +103,17 @@ function onGestureState(args: GestureStateEventData) {
100103
console.log('onGestureState', state, prevState, view, extraData);
101104
}
102105
const manager = Manager.getInstance();
103-
const gestureHandler = = manager.createGestureHandler(HandlerType.PAN, 10, {
106+
const gestureHandler = manager.createGestureHandler(HandlerType.PAN, 10, {
104107
shouldCancelWhenOutside: false
105108
});
106109
gestureHandler.on(GestureHandlerTouchEvent, onGestureTouch, this);
107110
gestureHandler.on(GestureHandlerStateEvent, onGestureState, this);
108111
gestureHandler.attachToView(view);
109112
```
110113

111-
Right now you must not forget to store the ```gestureHandler``` somewhere or the gesture won't work on iOS (native object being released). This will be fixed in future versions.
114+
Right now you must not forget to store the `gestureHandler` somewhere or the gesture won't work on iOS (native object being released). This will be fixed in future versions.
112115

113-
Now about the API. All the gestures for the react counterpart exist with the same options and the same event ```extraData```.
116+
Now about the API. All the gestures for the react counterpart exist with the same options and the same event `extraData`.
114117

115118

116119
[](#gesturerootview)
@@ -132,7 +135,7 @@ In case you don't (drawer root view, modals, ...) then you can wrap your views i
132135

133136
## Overriding Nativescript gestures
134137

135-
This plugin can also override N gestures completely. This would give much more control over gestures and especially would allow to correctly handle simultaneous gestures likes `tap` and `longpress`
138+
This plugin can also override N gestures completely. This would give much more control over gestures and especially would allow to correctly handle simultaneous gestures likes `tap` and `longpress`.
136139

137140
To do that
138141

@@ -145,9 +148,7 @@ To do that
145148
## Credits
146149

147150
This is a port of [react-native-gesturehandler](https://kmagiera.github.io/react-native-gesture-handler/).
148-
The source is based on the source code by [Krzysztof Magiera](https://github.com/kmagiera). Dont hesitate to go and thank him for his work!
149-
150-
151+
The source is based on the source code by [Krzysztof Magiera](https://github.com/kmagiera). Don't hesitate to go and thank him for his work!
151152

152153
### Examples:
153154

@@ -262,6 +263,7 @@ One easy solution is t modify `~/.gitconfig` and add
262263

263264
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
264265

266+
265267
[](#demos-and-development)
266268

267269
## Demos and Development

docs/assets/navigation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)