@@ -11,6 +11,7 @@ import {
1111 Button ,
1212 Alert ,
1313 useColorScheme ,
14+ Platform ,
1415} from 'react-native' ;
1516import {
1617 DarkTheme ,
@@ -47,6 +48,10 @@ const FourTabsTransparentScrollEdgeAppearance = () => {
4748 return < FourTabs scrollEdgeAppearance = "transparent" /> ;
4849} ;
4950
51+ const FourTabsOpaqueScrollEdgeAppearance = ( ) => {
52+ return < FourTabs scrollEdgeAppearance = "opaque" /> ;
53+ } ;
54+
5055const FourTabsWithBarTintColor = ( ) => {
5156 return < FourTabs barTintColor = { '#87CEEB' } /> ;
5257} ;
@@ -63,20 +68,32 @@ const examples = [
6368 { component : ThreeTabs , name : 'Three Tabs' } ,
6469 { component : FourTabs , name : 'Four Tabs' } ,
6570 { component : SFSymbols , name : 'SF Symbols' } ,
66- { component : LabeledTabs , name : 'Labeled Tabs' } ,
71+ { component : LabeledTabs , name : 'Labeled Tabs' , platform : 'android' } ,
6772 {
6873 component : FourTabsIgnoreSafeArea ,
6974 name : 'Four Tabs - No header' ,
75+ platform : 'ios' ,
7076 screenOptions : { headerShown : false } ,
7177 } ,
7278 {
7379 component : FourTabsRippleColor ,
7480 name : 'Four Tabs with ripple Color' ,
81+ platform : 'android' ,
82+ } ,
83+ {
84+ component : FourTabsNoAnimations ,
85+ name : 'Four Tabs - no animations' ,
86+ platform : 'ios' ,
7587 } ,
76- { component : FourTabsNoAnimations , name : 'Four Tabs - no animations' } ,
7788 {
7889 component : FourTabsTransparentScrollEdgeAppearance ,
7990 name : 'Four Tabs - Transparent scroll edge appearance' ,
91+ platform : 'ios' ,
92+ } ,
93+ {
94+ component : FourTabsOpaqueScrollEdgeAppearance ,
95+ name : 'Four Tabs - Opaque scroll edge appearance' ,
96+ platform : 'ios' ,
8097 } ,
8198 {
8299 component : FourTabsWithBarTintColor ,
@@ -85,6 +102,7 @@ const examples = [
85102 {
86103 component : FourTabsTranslucent ,
87104 name : 'Four Tabs - Translucent tab bar' ,
105+ platform : 'android' ,
88106 } ,
89107 {
90108 component : FourTabsActiveIndicatorColor ,
@@ -109,19 +127,23 @@ function App() {
109127 const navigation = useNavigation ( ) ;
110128 return (
111129 < ScrollView >
112- { examples . map ( ( example ) => (
113- < TouchableOpacity
114- key = { example . name }
115- testID = { example . name }
116- style = { styles . exampleTouchable }
117- onPress = { ( ) => {
118- //@ts -ignore
119- navigation . navigate ( example . name ) ;
120- } }
121- >
122- < Text style = { styles . exampleText } > { example . name } </ Text >
123- </ TouchableOpacity >
124- ) ) }
130+ { examples
131+ . filter ( ( example ) =>
132+ 'platform' in example ? example ?. platform === Platform . OS : example
133+ )
134+ . map ( ( example ) => (
135+ < TouchableOpacity
136+ key = { example . name }
137+ testID = { example . name }
138+ style = { styles . exampleTouchable }
139+ onPress = { ( ) => {
140+ //@ts -ignore
141+ navigation . navigate ( example . name ) ;
142+ } }
143+ >
144+ < Text style = { styles . exampleText } > { example . name } </ Text >
145+ </ TouchableOpacity >
146+ ) ) }
125147 </ ScrollView >
126148 ) ;
127149}
@@ -169,14 +191,20 @@ export default function Navigation() {
169191 ) ,
170192 } }
171193 />
172- { examples . map ( ( example , index ) => (
173- < NavigationStack . Screen
174- key = { index }
175- name = { example . name }
176- component = { example . component }
177- options = { example . screenOptions }
178- />
179- ) ) }
194+ { examples
195+ . filter ( ( example ) =>
196+ 'platform' in example
197+ ? example ?. platform === Platform . OS
198+ : example
199+ )
200+ . map ( ( example , index ) => (
201+ < NavigationStack . Screen
202+ key = { index }
203+ name = { example . name }
204+ component = { example . component }
205+ options = { example . screenOptions }
206+ />
207+ ) ) }
180208 </ NavigationStack . Navigator >
181209 </ NavigationContainer >
182210 </ SafeAreaProvider >
0 commit comments