Skip to content

Commit a4f618c

Browse files
m-bertCopilotj-piasecki
authored
[docs] Add platform badges (#3975)
## Description This PR adds badges for platform specific features. | darkmode | lightmode | | ---------- | ---------- | |<img width="802" height="126" alt="image" src="https://github.com/user-attachments/assets/c5b190c4-9377-46c1-8abf-08a26a086011" /> | <img width="704" height="128" alt="image" src="https://github.com/user-attachments/assets/57d5ba62-4198-4718-afbe-732ef54f6b55" />| ## Test plan Read docs 🤓 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
1 parent 74cfcd6 commit a4f618c

File tree

13 files changed

+215
-35
lines changed

13 files changed

+215
-35
lines changed

packages/docs-gesture-handler/docs/components/buttons.mdx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_label: Buttons
77
import useBaseUrl from '@docusaurus/useBaseUrl';
88
import GifGallery from '@site/components/GifGallery';
99

10+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
11+
1012
<GifGallery>
1113
<img src={useBaseUrl('gifs/samplebutton.gif')} width="280" />
1214
</GifGallery>
@@ -37,39 +39,50 @@ exclusive?: boolean;
3739

3840
Defines if more than one button could be pressed simultaneously. By default set to `true`.
3941

40-
### rippleColor (**Android only**)
42+
<HeaderWithBadge platforms={['android']}>
43+
### rippleColor
44+
</HeaderWithBadge>
4145

4246
```ts
4347
rippleColor?: number | ColorValue | null;
4448
```
4549

4650
Defines [color](https://reactnative.dev/docs/colors) of native [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) animation.
4751

48-
### rippleRadius (**Android only**)
52+
<HeaderWithBadge platforms={['android']}>
53+
### rippleRadius
54+
</HeaderWithBadge>
55+
4956

5057
```ts
5158
rippleRadius?: number | null;
5259
```
5360

5461
Defines radius of native [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) animation.
5562

56-
### borderless (**Android only**)
63+
<HeaderWithBadge platforms={['android']}>
64+
### borderless
65+
</HeaderWithBadge>
5766

5867
```ts
5968
borderless?: boolean;
6069
```
6170

6271
If set to `false`, [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) animation will render only within view bounds.
6372

64-
### foreground (**Android only**)
73+
<HeaderWithBadge platforms={['android']}>
74+
### foreground
75+
</HeaderWithBadge>
6576

6677
```ts
6778
foreground?: boolean;
6879
```
6980

7081
Defines whether the [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) animation should be drawn on the foreground of the view.
7182

72-
### touchSoundDisabled (**Android only**)
83+
<HeaderWithBadge platforms={['android']}>
84+
### touchSoundDisabled
85+
</HeaderWithBadge>
7386

7487
```ts
7588
touchSoundDisabled?: boolean;
@@ -127,7 +140,9 @@ underlayColor?: string;
127140

128141
Background color that will be dimmed when button is in active state.
129142

130-
### activeOpacity (**iOS only**)
143+
<HeaderWithBadge platforms={['iOS']}>
144+
### activeOpacity
145+
</HeaderWithBadge>
131146

132147
```ts
133148
activeOpacity?: number;
@@ -139,7 +154,9 @@ Opacity applied to the underlay when button is in active state.
139154

140155
This type of button component should be used with simple icon-only or text-only buttons. The interaction will be different depending on platform: on Android a borderless ripple will be rendered (it means that the ripple will animate into a circle that can span outside of the view bounds), whereas on iOS the button will be dimmed (similar to how `TouchableOpacity` works). In addition to the props of [`BaseButton`](#basebutton), it accepts the following:
141156

142-
### activeOpacity (**iOS only**)
157+
<HeaderWithBadge platforms={['iOS']}>
158+
### activeOpacity
159+
</HeaderWithBadge>
143160

144161
```ts
145162
activeOpacity?: number;

packages/docs-gesture-handler/docs/components/pressable.mdx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_label: Pressable
77
import useBaseUrl from '@docusaurus/useBaseUrl';
88
import GifGallery from '@site/components/GifGallery';
99

10+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
11+
1012
:::info
1113
This component is a drop-in replacement for the `Pressable` component.
1214
:::
@@ -87,31 +89,39 @@ cancelable?: null | boolean;
8789

8890
Whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`.
8991

90-
### onHoverIn (Web only)
92+
<HeaderWithBadge platforms={['android', 'web']}>
93+
### onHoverIn
94+
</HeaderWithBadge>
9195

9296
```ts
9397
onHoverIn?: null | ((event: PressableEvent) => void);
9498
```
9599

96100
Called when pointer is hovering over the element.
97101

98-
### onHoverOut (Web only)
102+
<HeaderWithBadge platforms={['android', 'web']}>
103+
### onHoverOut
104+
</HeaderWithBadge>
99105

100106
```ts
101107
onHoverOut?: null | ((event: PressableEvent) => void);
102108
```
103109

104110
Called when pointer stops hovering over the element.
105111

106-
### delayHoverIn (Web only)
112+
<HeaderWithBadge platforms={['web']}>
113+
### delayHoverIn
114+
</HeaderWithBadge>
107115

108116
```ts
109117
delayHoverIn?: number | null;
110118
```
111119

112120
Duration to wait after hover in before calling `onHoverIn`.
113121

114-
### delayHoverOut (Web only)
122+
<HeaderWithBadge platforms={['web']}>
123+
### delayHoverOut
124+
</HeaderWithBadge>
115125

116126
```ts
117127
delayHoverOut?: number | null;
@@ -135,7 +145,9 @@ disabled?: null | boolean;
135145

136146
Whether the `Pressable` behavior is disabled.
137147

138-
### hitSlop (Android & iOS only)
148+
<HeaderWithBadge platforms={['android', 'iOS']}>
149+
### hitSlop
150+
</HeaderWithBadge>
139151

140152
```ts
141153
hitSlop?: null | Insets | number;
@@ -145,7 +157,9 @@ Additional distance outside of the view in which a press is detected and [`onPre
145157

146158
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).
147159

148-
### pressRetentionOffset (Android & iOS only)
160+
<HeaderWithBadge platforms={['android', 'iOS']}>
161+
### pressRetentionOffset
162+
</HeaderWithBadge>
149163

150164
```ts
151165
pressRetentionOffset?: null | Insets | number;
@@ -156,15 +170,19 @@ press before [`onPressOut`](#onpressout) is triggered.
156170

157171
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).
158172

159-
### android_disableSound (Android only)
173+
<HeaderWithBadge platforms={['android']}>
174+
### android_disableSound
175+
</HeaderWithBadge>
160176

161177
```ts
162178
android_disableSound?: null | boolean;
163179
```
164180

165181
If `true`, doesn't play system sound on touch.
166182

167-
### android_ripple (Android only)
183+
<HeaderWithBadge platforms={['android']}>
184+
### android_ripple
185+
</HeaderWithBadge>
168186

169187
```ts
170188
android_ripple?: null | PressableAndroidRippleConfig;

packages/docs-gesture-handler/docs/components/reanimated-drawer-layout.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar_label: Reanimated Drawer Layout
66

77
import useBaseUrl from '@docusaurus/useBaseUrl';
88

9+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
10+
911
:::info
1012
This component acts as a cross-platform replacement for React Native's [`DrawerLayoutAndroid`](http://reactnative.dev/docs/drawerlayoutandroid.html) component, written using [Reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started). For detailed information on standard parameters, please refer to the [React Native documentation](http://reactnative.dev/docs/drawerlayoutandroid.html).
1113
:::
@@ -132,7 +134,9 @@ export enum DrawerState {
132134

133135
A function is called when the status of the drawer changes, taking `newState` to represent the drawer's interaction state and `drawerWillShow`, which is `true` when the drawer starts animating towards the open position and `false` otherwise.
134136

135-
### enableTrackpadTwoFingerGesture (iOS only)
137+
<HeaderWithBadge platforms={['iOS']}>
138+
### enableTrackpadTwoFingerGesture
139+
</HeaderWithBadge>
136140

137141
```ts
138142
enableTrackpadTwoFingerGesture?: boolean;
@@ -149,7 +153,9 @@ children?: ReactNode | ((openValue?: SharedValue<number>) => ReactNode);
149153

150154
Either a component rendered in the content view or a function. If `children` is a function, it receives an `openValue` parameter - [`SharedValue`](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value) that indicates the progress of the drawer's opening or closing animation. This value equals `0` when the drawer is closed and `1` when it is fully opened. The drawer component can use this value to animate its children during the opening or closing process. This function must return a [`ReactNode`](https://reactnative.dev/docs/react-node).
151155

152-
### mouseButton (Web & Android only)
156+
<HeaderWithBadge platforms={['android', 'web']}>
157+
### mouseButton
158+
</HeaderWithBadge>
153159

154160
<CollapsibleCode
155161
label="Show composed types definitions"
@@ -170,8 +176,9 @@ enum MouseButton {
170176

171177
Allows users to choose which mouse button should handler respond to. Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`. Default value is set to `MouseButton.LEFT`.
172178

173-
174-
### enableContextMenu (Web only)
179+
<HeaderWithBadge platforms={['web']}>
180+
### enableContextMenu
181+
</HeaderWithBadge>
175182

176183
```ts
177184
enableContextMenu: boolean;

packages/docs-gesture-handler/docs/components/reanimated_swipeable.mdx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_label: Reanimated Swipeable
77
import useBaseUrl from '@docusaurus/useBaseUrl';
88
import GifGallery from '@site/components/GifGallery'
99

10+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
11+
1012
:::info
1113
This component is a drop-in replacement for the `Swipeable` component, rewritten using [Reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
1214
:::
@@ -240,15 +242,19 @@ blocksExternalGesture?: AnyGesture | AnyGesture[];
240242

241243
Gestures that `Swipeable` will prevent from activating (see [gesture composition section](/docs/fundamentals/gesture-composition#simultaneouswith)).
242244

243-
### enableTrackpadTwoFingerGesture (iOS only)
245+
<HeaderWithBadge platforms={['iOS']}>
246+
### enableTrackpadTwoFingerGesture
247+
</HeaderWithBadge>
244248

245249
```ts
246250
enableTrackpadTwoFingerGesture?: boolean;
247251
```
248252

249253
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.
250254

251-
### mouseButton (Web & Android only)
255+
<HeaderWithBadge platforms={['android', 'web']}>
256+
### mouseButton
257+
</HeaderWithBadge>
252258

253259
<CollapsibleCode
254260
label="Show composed types definitions"
@@ -269,7 +275,9 @@ enum MouseButton {
269275

270276
Allows users to choose which mouse button should handler respond to. Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`. Default value is set to `MouseButton.LEFT`.
271277

272-
### enableContextMenu (Web only)
278+
<HeaderWithBadge platforms={['web']}>
279+
### enableContextMenu
280+
</HeaderWithBadge>
273281

274282
```ts
275283
enableContextMenu: boolean;

packages/docs-gesture-handler/docs/fundamentals/gesture-detector.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 4
66
---
77

88
import CollapsibleCode from '@site/src/components/CollapsibleCode';
9-
9+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
1010

1111
## Gesture Detector
1212

@@ -190,23 +190,29 @@ gesture: SingleGesture | ComposedGesture;
190190

191191
A gesture object containing the configuration and callbacks. Can be any of the base gestures or any [`ComposedGesture`](/docs/fundamentals/gesture-composition).
192192

193-
### userSelect (Web only)
193+
<HeaderWithBadge platforms={['web']}>
194+
### userSelect
195+
</HeaderWithBadge>
194196

195197
```ts
196198
userSelect: 'none' | 'auto' | 'text';
197199
```
198200

199201
This parameter allows to specify which `userSelect` property should be applied to underlying view. Default value is set to `"none"`.
200202

201-
### touchAction (Web only)
203+
<HeaderWithBadge platforms={['web']}>
204+
### touchAction
205+
</HeaderWithBadge>
202206

203207
```ts
204208
touchAction: TouchAction;
205209
```
206210

207211
This parameter allows to specify which `touchAction` property should be applied to underlying view. Supports all CSS [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/touch-action) values. Default value is set to `"none"`.
208212

209-
### enableContextMenu (Web only)
213+
<HeaderWithBadge platforms={['web']}>
214+
### enableContextMenu
215+
</HeaderWithBadge>
210216

211217
```ts
212218
enableContextMenu: boolean;

packages/docs-gesture-handler/docs/gestures/_shared/base-gesture-config.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import CollapsibleCode from '@site/src/components/CollapsibleCode';
22

3+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
4+
35
### enabled
46

57
```ts
@@ -67,7 +69,9 @@ testID: string;
6769

6870
Sets a `testID` property for gesture object, allowing for querying for it in tests.
6971

70-
### cancelsTouchesInView (**iOS only**)
72+
<HeaderWithBadge platforms={['iOS']}>
73+
### cancelsTouchesInView
74+
</HeaderWithBadge>
7175

7276
```ts
7377
cancelsTouchesInView: boolean | SharedValue<boolean>;

packages/docs-gesture-handler/docs/gestures/use-fling-gesture.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1212
import FlingGestureBasic from '@site/static/examples/FlingGestureBasic';
1313
import FlingGestureBasicSrc from '!!raw-loader!@site/static/examples/FlingGestureBasicSrc';
1414

15+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
16+
1517
<div className={webContainer}>
1618
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
1719
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
@@ -140,7 +142,9 @@ numberOfPointers: number | SharedValue<number>;
140142

141143
Determine exact number of points required to handle the fling gesture.
142144

143-
### mouseButton (Web & Android only)
145+
<HeaderWithBadge platforms={['android', 'web']}>
146+
### mouseButton
147+
</HeaderWithBadge>
144148

145149
<CollapsibleCode
146150
label="Show composed types definitions"

packages/docs-gesture-handler/docs/gestures/use-hover-gesture.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1212
import HoverGestureBasic from '@site/static/examples/HoverGestureBasic';
1313
import HoverGestureBasicSrc from '!!raw-loader!@site/static/examples/HoverGestureBasic';
1414

15+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
16+
1517
<div className={webContainer}>
1618
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
1719
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
@@ -91,7 +93,9 @@ const styles = StyleSheet.create({
9193

9294
<SharedValueInfo />
9395

94-
### effect (iOS only)
96+
<HeaderWithBadge platforms={['iOS']}>
97+
### effect
98+
</HeaderWithBadge>
9599

96100
<CollapsibleCode
97101
label="Show composed types definitions"

packages/docs-gesture-handler/docs/gestures/use-long-press-gesture.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1212
import LongPressGestureBasic from '@site/static/examples/LongPressGestureBasic';
1313
import LongPressGestureBasicSrc from '!!raw-loader!@site/static/examples/LongPressGestureBasic';
1414

15+
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';
16+
1517
<div className={webContainer}>
1618
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
1719
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
@@ -73,7 +75,9 @@ maxDistance: number | SharedValue<number>;
7375

7476
Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture. If the finger travels further than the defined distance and the gesture hasn't yet activated, it will fail to recognize the gesture. The default value is 10.
7577

76-
### mouseButton (Web & Android only)
78+
<HeaderWithBadge platforms={['android', 'web']}>
79+
### mouseButton
80+
</HeaderWithBadge>
7781

7882
<CollapsibleCode
7983
label="Show composed types definitions"

0 commit comments

Comments
 (0)