Skip to content

Commit 8fbe635

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents bd775aa + 759776d commit 8fbe635

File tree

16 files changed

+157
-67
lines changed

16 files changed

+157
-67
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.0.30](https://github.com/nativescript-community/gesturehandler/compare/v2.0.29...v2.0.30) (2024-03-22)
7+
8+
### Bug Fixes
9+
10+
* bug fix ([254419f](https://github.com/nativescript-community/gesturehandler/commit/254419f0bad6a33fbabb39da2cda0861a918ff1f))
11+
12+
## [2.0.29](https://github.com/nativescript-community/gesturehandler/compare/v2.0.28...v2.0.29) (2024-03-22)
13+
14+
### Bug Fixes
15+
16+
* **ios:** cancel gesture fix ([77a2ec0](https://github.com/nativescript-community/gesturehandler/commit/77a2ec07b9af89e6b02b27525e87e3dc0b6a61b2))
17+
* **ios:** gesture override more in line with N ([fb3744d](https://github.com/nativescript-community/gesturehandler/commit/fb3744d274aa5fa659450f1c1b58c73e26d12d3a))
18+
619
## [2.0.28](https://github.com/nativescript-community/gesturehandler/compare/v2.0.27...v2.0.28) (2024-02-24)
720

821
### Bug Fixes

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.

docs/assets/search.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.

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ <h1 align="center">@nativescript-community/gesturehandler</h1>
6868
<p><a href="#md:api"></a></p>
6969
<p><a href="#md:api"></a></p>
7070
<a id="md:api" class="tsd-anchor"></a><h2><a href="#md:api">API</a></h2><p>We need to do some wiring when your app starts, so open <code>app.ts</code> and add this before creating any View/App/Frame:</p>
71-
<a id="md:typescript" class="tsd-anchor"></a><h5><a href="#md:typescript">TypeScript</a></h5><pre><code class="language-ts"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">install</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@nativescript-community/gesturehandler&quot;</span><span class="hl-1">;</span><br/><span class="hl-4">install</span><span class="hl-1">();</span>
71+
<a id="md:typescript" class="tsd-anchor"></a><h5><a href="#md:typescript">TypeScript</a></h5><pre><code class="language-ts"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">install</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@nativescript-community/gesturehandler&#39;</span><span class="hl-1">;</span><br/><span class="hl-4">install</span><span class="hl-1">();</span>
7272
</code><button>Copy</button></pre>
7373
<p>You create a gesture handler using something like this:</p>
74-
<pre><code class="language-typescript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">GestureHandlerTouchEvent</span><span class="hl-1">, </span><span class="hl-2">GestureHandlerStateEvent</span><span class="hl-1">, </span><span class="hl-2">GestureStateEventData</span><span class="hl-1">, </span><span class="hl-2">GestureTouchEventData</span><span class="hl-1">, </span><span class="hl-2">HandlerType</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@nativescript-community/gesturehandler&#39;</span><span class="hl-1">;</span><br/><br/><br/><span class="hl-5">function</span><span class="hl-1"> </span><span class="hl-4">onGestureTouch</span><span class="hl-1">(</span><span class="hl-2">args</span><span class="hl-1">: </span><span class="hl-6">GestureTouchEventData</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">const</span><span class="hl-1"> { </span><span class="hl-7">state</span><span class="hl-1">, </span><span class="hl-7">extraData</span><span class="hl-1">, </span><span class="hl-7">view</span><span class="hl-1"> } = </span><span class="hl-2">args</span><span class="hl-1">.</span><span class="hl-2">data</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">view</span><span class="hl-1">.</span><span class="hl-2">translateX</span><span class="hl-1"> = </span><span class="hl-2">extraData</span><span class="hl-1">.</span><span class="hl-2">translationX</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">view</span><span class="hl-1">.</span><span class="hl-2">translateY</span><span class="hl-1"> = </span><span class="hl-2">extraData</span><span class="hl-1">.</span><span class="hl-2">translationY</span><span class="hl-1">;</span><br/><span class="hl-1">}</span><br/><span class="hl-5">function</span><span class="hl-1"> </span><span class="hl-4">onGestureState</span><span class="hl-1">(</span><span class="hl-2">args</span><span class="hl-1">: </span><span class="hl-6">GestureStateEventData</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">const</span><span class="hl-1"> { </span><span class="hl-7">state</span><span class="hl-1">, </span><span class="hl-7">prevState</span><span class="hl-1">, </span><span class="hl-7">extraData</span><span class="hl-1">, </span><span class="hl-7">view</span><span class="hl-1"> } = </span><span class="hl-2">args</span><span class="hl-1">.</span><span class="hl-2">data</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-4">log</span><span class="hl-1">(</span><span class="hl-3">&#39;onGestureState&#39;</span><span class="hl-1">, </span><span class="hl-2">state</span><span class="hl-1">, </span><span class="hl-2">prevState</span><span class="hl-1">, </span><span class="hl-2">view</span><span class="hl-1">, </span><span class="hl-2">extraData</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">manager</span><span class="hl-1"> = </span><span class="hl-2">Manager</span><span class="hl-1">.</span><span class="hl-4">getInstance</span><span class="hl-1">();</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">gestureHandler</span><span class="hl-1"> = = </span><span class="hl-2">manager</span><span class="hl-1">.</span><span class="hl-4">createGestureHandler</span><span class="hl-1">(</span><span class="hl-2">HandlerType</span><span class="hl-1">.</span><span class="hl-7">PAN</span><span class="hl-1">, </span><span class="hl-8">10</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">shouldCancelWhenOutside:</span><span class="hl-1"> </span><span class="hl-5">false</span><br/><span class="hl-1">});</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">on</span><span class="hl-1">(</span><span class="hl-2">GestureHandlerTouchEvent</span><span class="hl-1">, </span><span class="hl-2">onGestureTouch</span><span class="hl-1">, </span><span class="hl-5">this</span><span class="hl-1">);</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">on</span><span class="hl-1">(</span><span class="hl-2">GestureHandlerStateEvent</span><span class="hl-1">, </span><span class="hl-2">onGestureState</span><span class="hl-1">, </span><span class="hl-5">this</span><span class="hl-1">);</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">attachToView</span><span class="hl-1">(</span><span class="hl-2">view</span><span class="hl-1">);</span>
74+
<pre><code class="language-typescript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">GestureHandlerTouchEvent</span><span class="hl-1">, </span><span class="hl-2">GestureHandlerStateEvent</span><span class="hl-1">, </span><span class="hl-2">GestureStateEventData</span><span class="hl-1">, </span><span class="hl-2">GestureTouchEventData</span><span class="hl-1">, </span><span class="hl-2">HandlerType</span><span class="hl-1">, </span><span class="hl-2">Manager</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@nativescript-community/gesturehandler&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">function</span><span class="hl-1"> </span><span class="hl-4">onGestureTouch</span><span class="hl-1">(</span><span class="hl-2">args</span><span class="hl-1">: </span><span class="hl-6">GestureTouchEventData</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">const</span><span class="hl-1"> { </span><span class="hl-7">state</span><span class="hl-1">, </span><span class="hl-7">extraData</span><span class="hl-1">, </span><span class="hl-7">view</span><span class="hl-1"> } = </span><span class="hl-2">args</span><span class="hl-1">.</span><span class="hl-2">data</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">view</span><span class="hl-1">.</span><span class="hl-2">translateX</span><span class="hl-1"> = </span><span class="hl-2">extraData</span><span class="hl-1">.</span><span class="hl-2">translationX</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">view</span><span class="hl-1">.</span><span class="hl-2">translateY</span><span class="hl-1"> = </span><span class="hl-2">extraData</span><span class="hl-1">.</span><span class="hl-2">translationY</span><span class="hl-1">;</span><br/><span class="hl-1">}</span><br/><span class="hl-5">function</span><span class="hl-1"> </span><span class="hl-4">onGestureState</span><span class="hl-1">(</span><span class="hl-2">args</span><span class="hl-1">: </span><span class="hl-6">GestureStateEventData</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">const</span><span class="hl-1"> { </span><span class="hl-7">state</span><span class="hl-1">, </span><span class="hl-7">prevState</span><span class="hl-1">, </span><span class="hl-7">extraData</span><span class="hl-1">, </span><span class="hl-7">view</span><span class="hl-1"> } = </span><span class="hl-2">args</span><span class="hl-1">.</span><span class="hl-2">data</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-4">log</span><span class="hl-1">(</span><span class="hl-3">&#39;onGestureState&#39;</span><span class="hl-1">, </span><span class="hl-2">state</span><span class="hl-1">, </span><span class="hl-2">prevState</span><span class="hl-1">, </span><span class="hl-2">view</span><span class="hl-1">, </span><span class="hl-2">extraData</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">manager</span><span class="hl-1"> = </span><span class="hl-2">Manager</span><span class="hl-1">.</span><span class="hl-4">getInstance</span><span class="hl-1">();</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">gestureHandler</span><span class="hl-1"> = </span><span class="hl-2">manager</span><span class="hl-1">.</span><span class="hl-4">createGestureHandler</span><span class="hl-1">(</span><span class="hl-2">HandlerType</span><span class="hl-1">.</span><span class="hl-7">PAN</span><span class="hl-1">, </span><span class="hl-8">10</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">shouldCancelWhenOutside:</span><span class="hl-1"> </span><span class="hl-5">false</span><br/><span class="hl-1">});</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">on</span><span class="hl-1">(</span><span class="hl-2">GestureHandlerTouchEvent</span><span class="hl-1">, </span><span class="hl-2">onGestureTouch</span><span class="hl-1">, </span><span class="hl-5">this</span><span class="hl-1">);</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">on</span><span class="hl-1">(</span><span class="hl-2">GestureHandlerStateEvent</span><span class="hl-1">, </span><span class="hl-2">onGestureState</span><span class="hl-1">, </span><span class="hl-5">this</span><span class="hl-1">);</span><br/><span class="hl-2">gestureHandler</span><span class="hl-1">.</span><span class="hl-4">attachToView</span><span class="hl-1">(</span><span class="hl-2">view</span><span class="hl-1">);</span>
7575
</code><button>Copy</button></pre>
7676
<p>Right now you must not forget to store the <code>gestureHandler</code> somewhere or the gesture won&#39;t work on iOS (native object being released). This will be fixed in future versions.</p>
7777
<p>Now about the API. All the gestures for the react counterpart exist with the same options and the same event <code>extraData</code>.</p>
@@ -82,12 +82,12 @@ <h1 align="center">@nativescript-community/gesturehandler</h1>
8282
In case you don&#39;t (drawer root view, modals, ...) then you can wrap your views in a <code>GestureRootView</code> which inherits <code>GridLayout</code></p>
8383
<p><a href="#md:overriding-nativescript-gestures"></a></p>
8484
<p><a href="#md:overriding-nativescript-gestures"></a></p>
85-
<a id="md:overriding-nativescript-gestures" class="tsd-anchor"></a><h2><a href="#md:overriding-nativescript-gestures">Overriding Nativescript gestures</a></h2><p>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 <code>tap</code> and <code>longpress</code></p>
85+
<a id="md:overriding-nativescript-gestures" class="tsd-anchor"></a><h2><a href="#md:overriding-nativescript-gestures">Overriding Nativescript gestures</a></h2><p>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 <code>tap</code> and <code>longpress</code>.</p>
8686
<p>To do that </p>
8787
<p><a href="#md:credits"></a></p>
8888
<p><a href="#md:credits"></a></p>
8989
<a id="md:credits" class="tsd-anchor"></a><h2><a href="#md:credits">Credits</a></h2><p>This is a port of <a href="https://kmagiera.github.io/react-native-gesture-handler/">react-native-gesturehandler</a>.
90-
The source is based on the source code by <a href="https://github.com/kmagiera">Krzysztof Magiera</a>. Dont hesitate to go and thank him for his work!</p>
90+
The source is based on the source code by <a href="https://github.com/kmagiera">Krzysztof Magiera</a>. Don&#39;t hesitate to go and thank him for his work!</p>
9191
<a id="md:examples" class="tsd-anchor"></a><h3><a href="#md:examples">Examples:</a></h3><ul>
9292
<li><a href="demo-snippets/vue/Basic.vue">Basic</a><ul>
9393
<li>A basic example showing that overriding N gestures works, even in modals</li>

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.0.28",
2+
"version": "2.0.30",
33
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
44
"packages": [
55
"packages/*"

0 commit comments

Comments
 (0)