-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[docs] Buttons #3968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Buttons #3968
Changes from 3 commits
4b63fcb
38219bf
4e99364
4de1cff
e43bb9b
2418206
698a100
8b70502
c479294
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,13 +35,15 @@ The exception to thait is `Gesture.ForceTouch` which DOES NOT have a counterpart | |
| #### Callback changes | ||
|
|
||
| In Gesture Handler 3 some of the callbacks were renamed, namely: | ||
|
|
||
| - `onStart` -> `onActivate` | ||
| - `onEnd` -> `onDeactivate` | ||
| - `onTouchesCancelled` -> `onTouchesCancel` | ||
|
|
||
| In the hooks API `onChange` is no longer available. Instead the `*change*` properties were moved to the event available inside `onUpdate`. | ||
|
|
||
| All callbacks of a gesture are now using the same type: | ||
|
|
||
| - `usePanGesture()` -> `PanGestureEvent` | ||
| - `useTapGesture()` -> `TapGestureEvent` | ||
| - `useLongPressGesture()` -> `LongPressGestureEvent` | ||
|
|
@@ -53,6 +55,7 @@ All callbacks of a gesture are now using the same type: | |
| - `useManualGesture()` -> `ManualGestureEvent` | ||
|
|
||
| The exception to this is touch events: | ||
|
|
||
| - `onTouchesDown` | ||
| - `onTouchesUp` | ||
| - `onTouchesMove` | ||
|
|
@@ -65,12 +68,14 @@ Where each callback receives `GestureTouchEvent` regardless of the hook used. | |
| In Gesture Handler 3, `stateManager` is no longer passed to `TouchEvent` callbacks. Instead, you should use the global `GestureStateManager`. | ||
|
|
||
| `GestureStateManager` provides methods for imperative state management: | ||
|
|
||
| - .begin(handlerTag: number) | ||
| - .activate(handlerTag: number) | ||
| - .deactivate(handlerTag: number) (.end() in the old API) | ||
| - .fail(handlerTag: number) | ||
|
|
||
| `handlerTag` can be obtained in two ways: | ||
|
|
||
| 1. From the gesture object returned by the hook (`gesture.handlerTag`) | ||
| 2. From the event inside callback (`event.handlerTag`) | ||
|
|
||
|
|
@@ -83,13 +88,15 @@ Callback definitions CANNOT reference the gesture that's being defined. In this | |
| `Gesture.Simultaneous(gesture1, gesture2);` becomes `useSimultaneousGestures(pan1, pan2);` | ||
|
|
||
| All relations from the old API and their counterparts in the new one: | ||
|
|
||
| - `Gesture.Race()` -> `useCompetingGestures()` | ||
| - `Gesture.Simultaneous()` -> `useSimultaneousGestures()` | ||
| - `Gesture.Exclusive()` -> `useExclusiveGestures()` | ||
|
|
||
| #### Cross components relations properties | ||
|
|
||
| Properties used to define cross-components interactions were renamed: | ||
|
|
||
| - `.simultaneousWithExternalGesture` -> `simultaneousWith:` | ||
| - `.requireExternalGestureToFail` -> `requireToFail:` | ||
| - `.blocksExternalGesture` -> `block:` | ||
|
|
@@ -160,6 +167,8 @@ Don't suggest replacing buttons from Gesture Handler with components from React | |
|
|
||
| The implementation of buttons has been updated, resolving most button-related issues. They have also been internally rewritten to utilize the new hook API. The legacy JS implementations of button components are still accessible but have been renamed with the prefix `Legacy`, e.g., `RectButton` is now available as `LegacyRectButton`. Those still use the new native component under the hood. | ||
|
|
||
| `PureNativeButton` has been removed. If encountered, inform the user that it has been removed and let them decide how to handle that case. They can achieve similar funcionality with other buttons. | ||
|
m-bert marked this conversation as resolved.
Outdated
m-bert marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably want to suggest possible solutions it can propose to the user
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it depends on their use case. Using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure there is a clear migration path here - I think the only use case for You'd most likely need to wrap the button with a view and animate that, while having the button styled in a way to adapt to the view changes. We could add that to the skill, with some note that the agent should ask or at least inform the user that it needs double checking. |
||
|
|
||
| Other components have also been internally rewritten using the new hook API but are exported under their original names, so no changes are necessary on your part. However, if you need to use the previous implementation for any reason, the legacy components are also available and are prefixed with `Legacy`, e.g., `ScrollView` is now available as `LegacyScrollView`. | ||
|
|
||
| ### Replaced types | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.