Skip to content

Commit 254419f

Browse files
committed
fix: bug fix
1 parent 5ea92af commit 254419f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

packages/gesturehandler/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
[](#installation)
6161

6262
## Installation
63+
6364
Run the following command from the root of your project:
6465

6566
`ns plugin add @nativescript-community/gesturehandler`
@@ -70,16 +71,18 @@ Run the following command from the root of your project:
7071
## API
7172

7273
We need to do some wiring when your app starts, so open `app.ts` and add this before creating any View/App/Frame:
74+
7375
##### TypeScript
76+
7477
```ts
75-
import { install } from "@nativescript-community/gesturehandler";
78+
import { install } from '@nativescript-community/gesturehandler';
7679
install();
7780
```
7881

7982
You create a gesture handler using something like this:
80-
```typescript
81-
import { GestureHandlerTouchEvent, GestureHandlerStateEvent, GestureStateEventData, GestureTouchEventData, HandlerType } from '@nativescript-community/gesturehandler';
8283

84+
```typescript
85+
import { GestureHandlerTouchEvent, GestureHandlerStateEvent, GestureStateEventData, GestureTouchEventData, HandlerType, Manager } from '@nativescript-community/gesturehandler';
8386

8487
function onGestureTouch(args: GestureTouchEventData) {
8588
const { state, extraData, view } = args.data;
@@ -91,17 +94,17 @@ function onGestureState(args: GestureStateEventData) {
9194
console.log('onGestureState', state, prevState, view, extraData);
9295
}
9396
const manager = Manager.getInstance();
94-
const gestureHandler = = manager.createGestureHandler(HandlerType.PAN, 10, {
97+
const gestureHandler = manager.createGestureHandler(HandlerType.PAN, 10, {
9598
shouldCancelWhenOutside: false
9699
});
97100
gestureHandler.on(GestureHandlerTouchEvent, onGestureTouch, this);
98101
gestureHandler.on(GestureHandlerStateEvent, onGestureState, this);
99102
gestureHandler.attachToView(view);
100103
```
101104

102-
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.
105+
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.
103106

104-
Now about the API. All the gestures for the react counterpart exist with the same options and the same event ```extraData```.
107+
Now about the API. All the gestures for the react counterpart exist with the same options and the same event `extraData`.
105108

106109

107110
[](#gesturerootview)
@@ -117,7 +120,7 @@ In case you don't (drawer root view, modals, ...) then you can wrap your views i
117120

118121
## Overriding Nativescript gestures
119122

120-
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`
123+
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`.
121124

122125
To do that
123126

@@ -127,9 +130,7 @@ To do that
127130
## Credits
128131

129132
This is a port of [react-native-gesturehandler](https://kmagiera.github.io/react-native-gesture-handler/).
130-
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!
131-
132-
133+
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!
133134

134135
### Examples:
135136

@@ -233,4 +234,4 @@ One easy solution is t modify `~/.gitconfig` and add
233234

234235
## Questions
235236

236-
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).
237+
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).

src/gesturehandler/gestures_override.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ class CommonGestureEventData implements GestureEventData {
364364
public prepare(view: View, event) {
365365
this.view = view;
366366
this.object = view;
367-
this.ios = event.ios;
368-
this.android = event.android;
367+
this.ios = event.data.ios;
368+
this.android = event.data.android;
369369
this._activePointers = undefined;
370370
this._allPointers = undefined;
371371
this.eventData = event.data;

0 commit comments

Comments
 (0)