-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[docs] Add platform badges #3975
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
Changes from 56 commits
a14db83
9e1f534
54889bb
3e82cf8
e005621
90b1aa4
a5b73b3
6c4aa0f
b2f97c5
8cb20ab
8f442f1
12abfeb
1094f92
d91e097
c503ea1
31a8db3
b3efbbe
d201b3e
62d0fe8
64aa192
4667c7d
5f40baf
800b37d
004f919
e8ddacc
128b226
cc1e783
d48e4ea
9f1ec51
9b4aff8
0ce4f89
1b48239
e9e88a5
5fcdc6c
6d909f3
6563cdc
f3500a4
9840339
3d706ec
2a877d9
f927bf5
18e4350
8232dc8
264a843
4fd4d8c
a09df73
f94da57
c9c429e
ca8179c
788827a
d247707
94526fd
04f992e
4daad27
a997a49
b6eead3
8ba5b1c
d52b0f9
79b7f52
b45919e
b6efac4
e15ee60
0cd3c28
549b6a7
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 |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ sidebar_label: Pressable | |
| import useBaseUrl from '@docusaurus/useBaseUrl'; | ||
| import GifGallery from '@site/components/GifGallery'; | ||
|
|
||
| import HeaderWithBadge from '@site/src/components/HeaderWithBadge'; | ||
|
|
||
| :::info | ||
| This component is a drop-in replacement for the `Pressable` component. | ||
| ::: | ||
|
|
@@ -87,31 +89,39 @@ cancelable?: null | boolean; | |
|
|
||
| Whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`. | ||
|
|
||
| ### onHoverIn (Web only) | ||
| <HeaderWithBadge platforms={['web']}> | ||
| ### onHoverIn | ||
| </HeaderWithBadge> | ||
|
|
||
| ```ts | ||
| onHoverIn?: null | ((event: PressableEvent) => void); | ||
| ``` | ||
|
|
||
| Called when pointer is hovering over the element. | ||
|
|
||
| ### onHoverOut (Web only) | ||
| <HeaderWithBadge platforms={['web']}> | ||
| ### onHoverOut | ||
| </HeaderWithBadge> | ||
|
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. same
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. Same as above |
||
|
|
||
| ```ts | ||
| onHoverOut?: null | ((event: PressableEvent) => void); | ||
| ``` | ||
|
|
||
| Called when pointer stops hovering over the element. | ||
|
|
||
| ### delayHoverIn (Web only) | ||
| <HeaderWithBadge platforms={['web']}> | ||
| ### delayHoverIn | ||
| </HeaderWithBadge> | ||
|
j-piasecki marked this conversation as resolved.
|
||
|
|
||
| ```ts | ||
| delayHoverIn?: number | null; | ||
| ``` | ||
|
|
||
| Duration to wait after hover in before calling `onHoverIn`. | ||
|
|
||
| ### delayHoverOut (Web only) | ||
| <HeaderWithBadge platforms={['web']}> | ||
| ### delayHoverOut | ||
| </HeaderWithBadge> | ||
|
j-piasecki marked this conversation as resolved.
|
||
|
|
||
| ```ts | ||
| delayHoverOut?: number | null; | ||
|
|
@@ -135,7 +145,9 @@ disabled?: null | boolean; | |
|
|
||
| Whether the `Pressable` behavior is disabled. | ||
|
|
||
| ### hitSlop (Android & iOS only) | ||
| <HeaderWithBadge platforms={['android', 'iOS']}> | ||
| ### hitSlop | ||
| </HeaderWithBadge> | ||
|
|
||
| ```ts | ||
| hitSlop?: null | Insets | number; | ||
|
|
@@ -145,7 +157,9 @@ Additional distance outside of the view in which a press is detected and [`onPre | |
|
|
||
| The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect). | ||
|
|
||
| ### pressRetentionOffset (Android & iOS only) | ||
| <HeaderWithBadge platforms={['android', 'iOS']}> | ||
| ### pressRetentionOffset | ||
| </HeaderWithBadge> | ||
|
|
||
| ```ts | ||
| pressRetentionOffset?: null | Insets | number; | ||
|
|
@@ -156,15 +170,19 @@ press before [`onPressOut`](#onpressout) is triggered. | |
|
|
||
| The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect). | ||
|
|
||
| ### android_disableSound (Android only) | ||
| <HeaderWithBadge platforms={['android']}> | ||
| ### android_disableSound | ||
| </HeaderWithBadge> | ||
|
|
||
| ```ts | ||
| android_disableSound?: null | boolean; | ||
| ``` | ||
|
|
||
| If `true`, doesn't play system sound on touch. | ||
|
|
||
| ### android_ripple (Android only) | ||
| <HeaderWithBadge platforms={['android']}> | ||
| ### android_ripple | ||
| </HeaderWithBadge> | ||
|
|
||
| ```ts | ||
| android_ripple?: null | PressableAndroidRippleConfig; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ import SharedValueInfo from './\_shared/shared-value-info.md'; | |
|
|
||
| import CollapsibleCode from '@site/src/components/CollapsibleCode'; | ||
|
|
||
| import HeaderWithBadge from '@site/src/components/HeaderWithBadge'; | ||
|
|
||
| <div className={webContainer}> | ||
| <div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}> | ||
| <video playsInline autoPlay muted loop style={{maxWidth: 360}}> | ||
|
|
@@ -209,23 +211,29 @@ When the finger moves outside this range (in points) along X axis and gesture ha | |
| If range is set as an array, first value must be lower or equal to 0, a the second one higher or equal to 0. | ||
| If only one number `p` is given a range of `(-inf, p)` will be used if `p` is higher or equal to 0 and `(-p, inf)` otherwise. | ||
|
|
||
| ### averageTouches (Android only) | ||
| <HeaderWithBadge platforms={['android']}> | ||
| ### averageTouches | ||
| </HeaderWithBadge> | ||
|
j-piasecki marked this conversation as resolved.
|
||
|
|
||
| ```ts | ||
| averageTouches: boolean | SharedValue<boolean>; | ||
| ``` | ||
|
|
||
| Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen). This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values. | ||
|
|
||
| ### enableTrackpadTwoFingerGesture (iOS only) | ||
| <HeaderWithBadge platforms={['iOS']}> | ||
| ### enableTrackpadTwoFingerGesture | ||
| </HeaderWithBadge> | ||
|
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. This also works on web
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. True, e15ee60 |
||
|
|
||
| ```ts | ||
| enableTrackpadTwoFingerGesture: boolean | SharedValue<boolean>; | ||
| ``` | ||
|
|
||
| Enables two-finger gestures on supported devices, for example iPads with trackpads. If not enabled the gesture will require click + drag, with enableTrackpadTwoFingerGesture swiping with two fingers will also trigger the gesture. | ||
|
|
||
| ### mouseButton (Web & Android only) | ||
| <HeaderWithBadge platforms={['android', 'web']}> | ||
| ### mouseButton | ||
| </HeaderWithBadge> | ||
|
|
||
| <CollapsibleCode | ||
| label="Show composed types definitions" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this also work on native when using mouse/stylus?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought about it. I'm not sure about iOS, I can test it on android though.