|
1 | 1 | import { Icon, Label, NativeTabs } from 'expo-router/unstable-native-tabs'; |
| 2 | +import { Tabs } from 'expo-router'; |
2 | 3 | import { BackgroundProvider } from 'providers/BackgroundProvider'; |
3 | | -import { DynamicColorIOS, Platform } from 'react-native'; |
4 | | - |
| 4 | +import { DynamicColorIOS, Platform, StyleSheet } from 'react-native'; |
| 5 | +import { BlurView } from 'expo-blur'; |
| 6 | +import { supportsLiquidGlass } from '@/helper/version'; |
5 | 7 | import { Colors } from '@/constants/theme'; |
| 8 | +import { IconSymbol } from '@/components/ui/icon-symbol'; |
| 9 | + |
| 10 | +// Fallback tab bar background for pre-liquid glass devices |
| 11 | +const TabBarBackground = () => ( |
| 12 | + <BlurView tint="dark" intensity={75} style={[StyleSheet.absoluteFill, { borderRadius: 8 }]} /> |
| 13 | +); |
6 | 14 |
|
7 | 15 | export default function TabLayout() { |
8 | | - return ( |
9 | | - <BackgroundProvider> |
10 | | - <NativeTabs |
11 | | - labelStyle={{ |
12 | | - color: Platform.select({ |
| 16 | + // Use NativeTabs for iOS 26+ (Liquid Glass) |
| 17 | + if (supportsLiquidGlass()) { |
| 18 | + return ( |
| 19 | + <BackgroundProvider> |
| 20 | + <NativeTabs |
| 21 | + labelStyle={{ |
| 22 | + color: Platform.select({ |
| 23 | + ios: DynamicColorIOS({ |
| 24 | + dark: Colors.dark.text, |
| 25 | + light: Colors.light.text, |
| 26 | + }), |
| 27 | + }), |
| 28 | + }} |
| 29 | + tintColor={Platform.select({ |
13 | 30 | ios: DynamicColorIOS({ |
14 | | - dark: Colors.dark.text, |
15 | | - light: Colors.light.text, |
| 31 | + dark: Colors.dark.tint, |
| 32 | + light: Colors.light.tint, |
16 | 33 | }), |
17 | | - }), |
18 | | - }} |
19 | | - tintColor={Platform.select({ |
20 | | - ios: DynamicColorIOS({ |
21 | | - dark: Colors.dark.tint, |
22 | | - light: Colors.light.tint, |
23 | | - }), |
24 | | - })} |
25 | | - disableTransparentOnScrollEdge> |
26 | | - <NativeTabs.Trigger name="payments"> |
27 | | - <Icon |
28 | | - sf={{ |
29 | | - default: 'arrow.up.arrow.down', |
30 | | - selected: 'arrow.up.arrow.down', |
31 | | - }} |
32 | | - /> |
33 | | - <Label>Payments</Label> |
34 | | - </NativeTabs.Trigger> |
| 34 | + })} |
| 35 | + disableTransparentOnScrollEdge> |
| 36 | + <NativeTabs.Trigger name="payments"> |
| 37 | + <Icon |
| 38 | + sf={{ |
| 39 | + default: 'arrow.up.arrow.down', |
| 40 | + selected: 'arrow.up.arrow.down', |
| 41 | + }} |
| 42 | + /> |
| 43 | + <Label>Payments</Label> |
| 44 | + </NativeTabs.Trigger> |
35 | 45 |
|
36 | | - <NativeTabs.Trigger name="index"> |
37 | | - <Icon |
38 | | - sf={{ |
39 | | - default: 'wallet.bifold', |
40 | | - selected: 'wallet.bifold', |
41 | | - }} |
42 | | - /> |
43 | | - <Label>Walet</Label> |
44 | | - </NativeTabs.Trigger> |
| 46 | + <NativeTabs.Trigger name="index"> |
| 47 | + <Icon |
| 48 | + sf={{ |
| 49 | + default: 'wallet.bifold', |
| 50 | + selected: 'wallet.bifold', |
| 51 | + }} |
| 52 | + /> |
| 53 | + <Label>Wallet</Label> |
| 54 | + </NativeTabs.Trigger> |
45 | 55 |
|
46 | | - {/* <NativeTabs.Trigger name="explore"> |
| 56 | + {/* <NativeTabs.Trigger name="explore"> |
47 | 57 | <Icon sf={{ default: 'paperplane', selected: 'paperplane.fill' }} /> |
48 | 58 | <Label>Explore</Label> |
49 | 59 | </NativeTabs.Trigger> */} |
50 | 60 |
|
51 | | - {/* <NativeTabs.Trigger name="example"> |
| 61 | + {/* <NativeTabs.Trigger name="example"> |
52 | 62 | <Icon sf={{ default: 'paperplane', selected: 'paperplane.fill' }} /> |
53 | 63 | <Label>Example</Label> |
54 | 64 | </NativeTabs.Trigger> */} |
55 | | - </NativeTabs> |
| 65 | + </NativeTabs> |
| 66 | + </BackgroundProvider> |
| 67 | + ); |
| 68 | + } |
| 69 | + |
| 70 | + // Fallback for pre-iOS 26 and Android |
| 71 | + return ( |
| 72 | + <BackgroundProvider> |
| 73 | + <Tabs |
| 74 | + screenOptions={{ |
| 75 | + headerShown: false, |
| 76 | + tabBarBackground: () => <TabBarBackground />, |
| 77 | + tabBarStyle: { |
| 78 | + position: 'absolute', |
| 79 | + backgroundColor: 'transparent', |
| 80 | + borderTopColor: 'transparent', |
| 81 | + elevation: 0, |
| 82 | + }, |
| 83 | + tabBarActiveTintColor: Colors.dark.tint, |
| 84 | + tabBarInactiveTintColor: Colors.dark.text, |
| 85 | + }}> |
| 86 | + <Tabs.Screen |
| 87 | + name="payments" |
| 88 | + options={{ |
| 89 | + title: 'Payments', |
| 90 | + tabBarIcon: ({ color }) => ( |
| 91 | + <IconSymbol name="arrow.up.arrow.down" color={color} size={24} /> |
| 92 | + ), |
| 93 | + }} |
| 94 | + /> |
| 95 | + <Tabs.Screen |
| 96 | + name="index" |
| 97 | + options={{ |
| 98 | + title: 'Wallet', |
| 99 | + tabBarIcon: ({ color }) => <IconSymbol name="wallet.bifold" color={color} size={24} />, |
| 100 | + }} |
| 101 | + /> |
| 102 | + <Tabs.Screen |
| 103 | + name="explore" |
| 104 | + options={{ |
| 105 | + href: null, // Hide from tab bar |
| 106 | + }} |
| 107 | + /> |
| 108 | + <Tabs.Screen |
| 109 | + name="example" |
| 110 | + options={{ |
| 111 | + href: null, // Hide from tab bar |
| 112 | + }} |
| 113 | + /> |
| 114 | + </Tabs> |
56 | 115 | </BackgroundProvider> |
57 | 116 | ); |
58 | 117 | } |
0 commit comments