You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/components/buttons.mdx
+6-39Lines changed: 6 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,19 @@ import GifGallery from '@site/components/GifGallery';
13
13
14
14
The Gesture Handler library offers native components that function as buttons, serving as alternatives to `TouchableHighlight` or `TouchableOpacity` from the core React Native framework. These buttons process touch recognition natively, which ensures a deterministic response. This capability significantly enhances performance; for example, it allows for immediate ripple effects on Android, unlike `TouchableNativeFeedback`, which requires a touch event roundtrip to JavaScript that can cause delays, especially noticeable on older devices. Additionally, these components handle default platform interactions natively, particularly in scrollable containers where interactions are smartly delayed to prevent unintended highlighting during a fling.
15
15
16
-
Currently Gesture Handler library exposes three components that render native touchable elements under the hood:
16
+
Gesture Handler library exposes components that render native touchable elements under the hood:
17
17
18
+
-[`RawButton`](#rawbutton)
18
19
-[`BaseButton`](#basebutton)
19
20
-[`RectButton`](#rectbutton)
20
21
-[`BorderlessButton`](#borderlessbutton)
21
22
22
23
On top of that all the buttons are wrapped with [`Native`](/docs/gestures/use-native-gesture) gesture and therefore allow for all its [properties](/docs/gestures/use-native-gesture#config) to be applied to them.
23
24
25
+
## RawButton
26
+
27
+
The most basic button component does not provide any feedback and lacks props such as `onPress`. It serves as a foundation for other button components and is ideal if you wish to implement your own custom interactions for when the button is pressed.
28
+
24
29
## BaseButton
25
30
26
31
Can be used as a base class if you'd like to implement some custom interaction for when the button is pressed.
@@ -175,41 +180,3 @@ It should be used if you wish to handle non-crucial actions and supportive behav
Use a `PureNativeButton` for accessing the host component used for build more complex buttons listed above.
182
-
Normally it is not recommended to use, but it might be useful if you want to wrap it using [Animated](https://reactnative.dev/docs/animated) or [Reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/).
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/guides/upgrading-to-3.mdx
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -248,7 +248,7 @@ code2={
248
248
249
249
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 original button components are still accessible but have been renamed with the prefix `Legacy`, e.g., `RectButton` is now available as `LegacyRectButton`.
250
250
251
-
Although the legacy JS implementation of the buttons is still available, they also use the new host component internally.
251
+
Although the legacy JS implementation of the buttons is still available, they also use the new host component internally. Because of that, `PureNativeButton` is no longer available in Gesture Handler 3.
252
252
253
253
<details>
254
254
<summary>Legacy buttons</summary>
@@ -259,6 +259,7 @@ Although the legacy JS implementation of the buttons is still available, they al
259
259
|`BaseButton`|`LegacyBaseButton`|
260
260
|`RectButton`|`LegacyRectButton`|
261
261
|`BorderlessButton`|`LegacyBorderlessButton`|
262
+
|`PureNativeButton`|*Not available in Gesture Handler 3*|
@@ -160,6 +167,8 @@ Don't suggest replacing buttons from Gesture Handler with components from React
160
167
161
168
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.
162
169
170
+
`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.
171
+
163
172
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`.
0 commit comments