Files
Postiz-android/artifacts/postiz-mobile/app/(tabs)/_layout.tsx
T
antoinepiron bbbcf9f586 Add core functionality for mobile post scheduling app
Adds necessary dependencies including axios and react-native-calendars to pnpm-lock.yaml.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7b0991ce-c7b8-4c82-9acc-fd3f9e762a01
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: dc1266fa-8375-43e1-aca0-9df31350f647
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/86064bd6-c937-4ca5-a5bf-bbef5749fb60/7b0991ce-c7b8-4c82-9acc-fd3f9e762a01/kWnlAIM
Replit-Helium-Checkpoint-Created: true
2026-05-03 11:41:45 +00:00

143 lines
4.2 KiB
TypeScript

import { BlurView } from "expo-blur";
import { isLiquidGlassAvailable } from "expo-glass-effect";
import { Tabs } from "expo-router";
import { Icon, Label, NativeTabs } from "expo-router/unstable-native-tabs";
import { SymbolView } from "expo-symbols";
import { Feather } from "@expo/vector-icons";
import React from "react";
import { Platform, StyleSheet, View, useColorScheme } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useColors } from "@/hooks/useColors";
function NativeTabLayout() {
return (
<NativeTabs>
<NativeTabs.Trigger name="index">
<Icon sf={{ default: "calendar", selected: "calendar.fill" }} />
<Label>Calendar</Label>
</NativeTabs.Trigger>
<NativeTabs.Trigger name="posts">
<Icon sf={{ default: "list.bullet", selected: "list.bullet" }} />
<Label>Posts</Label>
</NativeTabs.Trigger>
<NativeTabs.Trigger name="compose">
<Icon sf={{ default: "plus.circle", selected: "plus.circle.fill" }} />
<Label>Compose</Label>
</NativeTabs.Trigger>
<NativeTabs.Trigger name="settings">
<Icon sf={{ default: "gear", selected: "gear" }} />
<Label>Settings</Label>
</NativeTabs.Trigger>
</NativeTabs>
);
}
function ClassicTabLayout() {
const colors = useColors();
const colorScheme = useColorScheme();
const isDark = colorScheme === "dark";
const isIOS = Platform.OS === "ios";
const isWeb = Platform.OS === "web";
const insets = useSafeAreaInsets();
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: colors.primary,
tabBarInactiveTintColor: colors.mutedForeground,
headerStyle: { backgroundColor: colors.background },
headerTitleStyle: {
fontFamily: "Inter_600SemiBold",
color: colors.foreground,
fontSize: 17,
},
headerShadowVisible: false,
headerTintColor: colors.primary,
tabBarStyle: {
position: "absolute",
backgroundColor: isIOS ? "transparent" : colors.background,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: colors.border,
elevation: 0,
...(isWeb ? { height: 84 } : {}),
},
tabBarBackground: () =>
isIOS ? (
<BlurView
intensity={80}
tint={isDark ? "dark" : "light"}
style={StyleSheet.absoluteFill}
/>
) : isWeb ? (
<View
style={[
StyleSheet.absoluteFill,
{ backgroundColor: colors.background },
]}
/>
) : null,
tabBarLabelStyle: {
fontFamily: "Inter_500Medium",
fontSize: 11,
},
}}
>
<Tabs.Screen
name="index"
options={{
title: "Calendar",
tabBarIcon: ({ color }) =>
isIOS ? (
<SymbolView name="calendar" tintColor={color} size={22} />
) : (
<Feather name="calendar" size={21} color={color} />
),
}}
/>
<Tabs.Screen
name="posts"
options={{
title: "Posts",
tabBarIcon: ({ color }) =>
isIOS ? (
<SymbolView name="list.bullet" tintColor={color} size={22} />
) : (
<Feather name="list" size={21} color={color} />
),
}}
/>
<Tabs.Screen
name="compose"
options={{
title: "Compose",
tabBarIcon: ({ color }) =>
isIOS ? (
<SymbolView name="plus.circle" tintColor={color} size={24} />
) : (
<Feather name="plus-circle" size={22} color={color} />
),
}}
/>
<Tabs.Screen
name="settings"
options={{
title: "Settings",
tabBarIcon: ({ color }) =>
isIOS ? (
<SymbolView name="gear" tintColor={color} size={22} />
) : (
<Feather name="settings" size={21} color={color} />
),
}}
/>
</Tabs>
);
}
export default function TabLayout() {
if (isLiquidGlassAvailable()) {
return <NativeTabLayout />;
}
return <ClassicTabLayout />;
}