Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ onTouchesUp: (event: GestureTouchEvent) => void

Called when pointers are lifted from the screen. It may carry information about more than one pointer because the events are batched.

### onTouchesCancelled
### onTouchesCancel

```ts
onTouchesCancelled: (event: GestureTouchEvent) => void
onTouchesCancel: (event: GestureTouchEvent) => void
```

Called when there will be no more information about this pointer. It may be called because the gesture has ended or was interrupted. It may carry information about more than one pointer because the events are batched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To demonstrate how to make a manual gesture we will make a simple one that track

<Step title="Step 6">
We also need to handle lifting fingers from the screen, which corresponds to `onTouchesUp`. Here we will just hide the pointers that were lifted and end the gesture if there are no more pointers on the screen.
Note that we are not handling `onTouchesCancelled` as in this very basic case we don't expect it to happen, however you should clear data about cancelled pointers (most of the time all active ones) when it is called.
Note that we are not handling `onTouchesCancel` as in this very basic case we don't expect it to happen, however you should clear data about cancelled pointers (most of the time all active ones) when it is called.
<Step6 />
</Step>

Expand Down
29 changes: 29 additions & 0 deletions packages/docs-gesture-handler/docs/guides/upgrading-to-3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,35 @@ code2={
`}
/>

### onChange

`onChange` callback has been removed, and its functionality has been integrated into `onUpdate`. You can now access `change*` properties in `onUpdate` callback.

<CodeComparison
label1={"RNGH 2"}
label2={"RNGH 3"}
code1={
`const pan = Gesture.Pan().onChange((e) => {
console.log(e.changeX);
});
`}
code2={
`const pan = usePanGesture({
onUpdate: (e) => {
console.log(e.changeX);
},
});
`}
/>

### state & oldState

The `state` and `oldState` properties are no longer available in event objects. Tracking state changes can now only be accomplished using the appropriate [callbacks](/docs/fundamentals/callbacks-events).

### Event types

The types of events have been unified for all callbacks. Each event falls into one of two categories: [`GestureEvent`](/docs/fundamentals/callbacks-events#gestureevent) for gesture callbacks, or [`GestureTouchEvent`](/docs/fundamentals/callbacks-events#touchevent) for `TouchEvent` callbacks.
Comment thread
m-bert marked this conversation as resolved.

### StateManager

In Gesture Handler 3, `stateManager` is no longer passed to `TouchEvent` callbacks. Instead, you should use the global [`GestureStateManager`](/docs/fundamentals/state-manager).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const nodes = new DataSet([
},
{
id: 4,
label: 'onTouchesCancelled',
label: 'onTouchesCancel',
level: 2,
},
]);
Expand Down