@@ -86,6 +86,7 @@ import { Icon } from '@swmansion/icons';
86
86
interface Example {
87
87
name : string ;
88
88
component : React . ComponentType ;
89
+ unsupportedPlatforms ?: Set < typeof Platform . OS > ;
89
90
}
90
91
interface ExamplesSection {
91
92
sectionTitle : string ;
@@ -130,8 +131,16 @@ const EXAMPLES: ExamplesSection[] = [
130
131
{ name : 'Bouncing box' , component : BouncingBox } ,
131
132
{ name : 'Pan responder' , component : PanResponder } ,
132
133
{ name : 'Horizontal drawer' , component : HorizontalDrawer } ,
133
- { name : 'Pager & drawer' , component : PagerAndDrawer } ,
134
- { name : 'Force touch' , component : ForceTouch } ,
134
+ {
135
+ name : 'Pager & drawer' ,
136
+ component : PagerAndDrawer ,
137
+ unsupportedPlatforms : new Set ( [ 'web' , 'ios' , 'macos' ] ) ,
138
+ } ,
139
+ {
140
+ name : 'Force touch' ,
141
+ component : ForceTouch ,
142
+ unsupportedPlatforms : new Set ( [ 'web' , 'android' , 'macos' ] ) ,
143
+ } ,
135
144
{ name : 'Fling' , component : Fling } ,
136
145
] ,
137
146
} ,
@@ -170,8 +179,9 @@ const EXAMPLES: ExamplesSection[] = [
170
179
component : NestedPressables as React . ComponentType ,
171
180
} ,
172
181
{
173
- name : 'Nested buttons (sound & ripple on Android )' ,
182
+ name : 'Nested buttons (sound & ripple)' ,
174
183
component : NestedButtons ,
184
+ unsupportedPlatforms : new Set ( [ 'web' , 'ios' , 'macos' ] ) ,
175
185
} ,
176
186
{ name : 'Double pinch & rotate' , component : DoublePinchRotate } ,
177
187
{ name : 'Double draggable' , component : DoubleDraggable } ,
@@ -180,12 +190,20 @@ const EXAMPLES: ExamplesSection[] = [
180
190
{ name : 'Combo' , component : ComboWithGHScroll } ,
181
191
{ name : 'Touchables' , component : TouchablesIndex as React . ComponentType } ,
182
192
{ name : 'MouseButtons' , component : MouseButtons } ,
183
- { name : 'ContextMenu (web only)' , component : ContextMenu } ,
193
+ {
194
+ name : 'ContextMenu' ,
195
+ component : ContextMenu ,
196
+ unsupportedPlatforms : new Set ( [ 'android' , 'ios' , 'macos' ] ) ,
197
+ } ,
184
198
{ name : 'PointerType' , component : PointerType } ,
185
199
{ name : 'Swipeable Reanimation' , component : SwipeableReanimation } ,
186
200
{ name : 'RectButton (borders)' , component : RectButtonBorders } ,
187
201
{ name : 'Gesturized pressable' , component : GesturizedPressable } ,
188
- { name : 'Web styles reset' , component : WebStylesResetExample } ,
202
+ {
203
+ name : 'Web styles reset' ,
204
+ component : WebStylesResetExample ,
205
+ unsupportedPlatforms : new Set ( [ 'android' , 'ios' , 'macos' ] ) ,
206
+ } ,
189
207
{ name : 'Stylus data' , component : StylusData } ,
190
208
] ,
191
209
} ,
@@ -285,6 +303,7 @@ function MainScreen({ navigation }: StackScreenProps<ParamListBase>) {
285
303
< MainScreenItem
286
304
name = { item . name }
287
305
onPressItem = { ( name ) => navigate ( navigation , name ) }
306
+ enabled = { ! item . unsupportedPlatforms ?. has ( Platform . OS ) }
288
307
/>
289
308
) }
290
309
renderSectionHeader = { ( { section : { sectionTitle } } ) => (
@@ -334,13 +353,17 @@ function OpenLastExampleSetting() {
334
353
interface MainScreenItemProps {
335
354
name : string ;
336
355
onPressItem : ( name : string ) => void ;
356
+ enabled : boolean ;
337
357
}
338
358
339
- function MainScreenItem ( { name, onPressItem } : MainScreenItemProps ) {
359
+ function MainScreenItem ( { name, onPressItem, enabled } : MainScreenItemProps ) {
340
360
return (
341
- < RectButton style = { [ styles . button ] } onPress = { ( ) => onPressItem ( name ) } >
361
+ < RectButton
362
+ enabled = { enabled }
363
+ style = { [ styles . button , ! enabled && styles . unavailableExample ] }
364
+ onPress = { ( ) => onPressItem ( name ) } >
342
365
< Text style = { styles . text } > { name } </ Text >
343
- { Platform . OS !== 'macos' && (
366
+ { Platform . OS !== 'macos' && enabled && (
344
367
< Icon name = "chevron-small-right" size = { 24 } color = "#bbb" />
345
368
) }
346
369
</ RectButton >
@@ -406,4 +429,8 @@ const styles = StyleSheet.create({
406
429
}
407
430
: { } ) ,
408
431
} ,
432
+ unavailableExample : {
433
+ backgroundColor : 'rgb(220, 220, 220)' ,
434
+ opacity : 0.3 ,
435
+ } ,
409
436
} ) ;
0 commit comments