Skip to content

Commit 4722cbb

Browse files
committed
Update _layout.tsx
1 parent 532c7cf commit 4722cbb

File tree

1 file changed

+98
-39
lines changed

1 file changed

+98
-39
lines changed

app/(drawer)/(tabs)/_layout.tsx

Lines changed: 98 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,117 @@
11
import { Icon, Label, NativeTabs } from 'expo-router/unstable-native-tabs';
2+
import { Tabs } from 'expo-router';
23
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';
57
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+
);
614

715
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({
1330
ios: DynamicColorIOS({
14-
dark: Colors.dark.text,
15-
light: Colors.light.text,
31+
dark: Colors.dark.tint,
32+
light: Colors.light.tint,
1633
}),
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>
3545

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>
4555

46-
{/* <NativeTabs.Trigger name="explore">
56+
{/* <NativeTabs.Trigger name="explore">
4757
<Icon sf={{ default: 'paperplane', selected: 'paperplane.fill' }} />
4858
<Label>Explore</Label>
4959
</NativeTabs.Trigger> */}
5060

51-
{/* <NativeTabs.Trigger name="example">
61+
{/* <NativeTabs.Trigger name="example">
5262
<Icon sf={{ default: 'paperplane', selected: 'paperplane.fill' }} />
5363
<Label>Example</Label>
5464
</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>
56115
</BackgroundProvider>
57116
);
58117
}

0 commit comments

Comments
 (0)