mirror of
https://github.com/SrIzan10/featheroom.git
synced 2026-06-06 00:56:49 +00:00
127 lines
3.7 KiB
TypeScript
127 lines
3.7 KiB
TypeScript
import { MaterialCommunityIcons } from '@expo/vector-icons'
|
|
import { Tabs, router } from 'expo-router'
|
|
import React from 'react'
|
|
import { Appbar, Menu, Tooltip } from 'react-native-paper'
|
|
|
|
import Locales from '@/lib/locales'
|
|
import { TabBar, TabsHeader } from '@/lib/ui'
|
|
|
|
const TabLayout = () => {
|
|
const [visible, setVisible] = React.useState(false)
|
|
|
|
return (
|
|
<Tabs
|
|
tabBar={(props) => <TabBar {...props} />}
|
|
screenOptions={{
|
|
tabBarHideOnKeyboard: true,
|
|
header: (props) => <TabsHeader navProps={props} children={undefined} />,
|
|
}}
|
|
>
|
|
<Tabs.Screen
|
|
name="index"
|
|
options={{
|
|
title: Locales.t('titleHome'),
|
|
headerRight: () => (
|
|
<>
|
|
<Tooltip title={Locales.t('search')}>
|
|
<Appbar.Action
|
|
icon="magnify"
|
|
onPress={() => router.push('/search')}
|
|
/>
|
|
</Tooltip>
|
|
<Menu
|
|
statusBarHeight={48}
|
|
visible={visible}
|
|
onDismiss={() => setVisible(false)}
|
|
anchor={
|
|
<Tooltip title={Locales.t('options')}>
|
|
<Appbar.Action
|
|
icon="dots-vertical"
|
|
onPress={() => setVisible(true)}
|
|
/>
|
|
</Tooltip>
|
|
}
|
|
>
|
|
<Menu.Item
|
|
title={Locales.t('titleSettings')}
|
|
leadingIcon="cog"
|
|
onPress={() => router.push('/(tabs)/settings')}
|
|
/>
|
|
<Menu.Item
|
|
title={Locales.t('stackNav')}
|
|
leadingIcon="card-multiple-outline"
|
|
onPress={() => router.push('/modal')}
|
|
/>
|
|
<Menu.Item
|
|
title={Locales.t('drawerNav')}
|
|
leadingIcon="gesture-swipe"
|
|
onPress={() => router.push('/drawer')}
|
|
/>
|
|
</Menu>
|
|
</>
|
|
),
|
|
tabBarIcon: (props) => (
|
|
<MaterialCommunityIcons
|
|
{...props}
|
|
size={24}
|
|
name={props.focused ? 'home' : 'home-outline'}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="profile"
|
|
options={{
|
|
title: Locales.t('profile'),
|
|
headerRight: () => (
|
|
<>
|
|
<Tooltip title={Locales.t('search')}>
|
|
<Appbar.Action
|
|
icon="magnify"
|
|
onPress={() => router.push('/search')}
|
|
/>
|
|
</Tooltip>
|
|
<Tooltip title={Locales.t('titleSettings')}>
|
|
<Appbar.Action
|
|
icon="cog"
|
|
onPress={() => router.push('/(tabs)/settings')}
|
|
/>
|
|
</Tooltip>
|
|
</>
|
|
),
|
|
tabBarIcon: (props) => (
|
|
<MaterialCommunityIcons
|
|
{...props}
|
|
size={24}
|
|
name={props.focused ? 'account' : 'account-outline'}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="settings"
|
|
options={{
|
|
title: Locales.t('titleSettings'),
|
|
headerRight: () => (
|
|
<Tooltip title={Locales.t('drawerNav')}>
|
|
<Appbar.Action
|
|
icon="gesture-swipe"
|
|
onPress={() => router.push('/drawer')}
|
|
/>
|
|
</Tooltip>
|
|
),
|
|
tabBarIcon: (props) => (
|
|
<MaterialCommunityIcons
|
|
{...props}
|
|
size={24}
|
|
name={props.focused ? 'cog' : 'cog-outline'}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
</Tabs>
|
|
)
|
|
}
|
|
|
|
export default TabLayout
|