tooot/src/screens/Tabs/Me.tsx

189 lines
6.3 KiB
TypeScript
Raw Normal View History

2021-01-14 00:43:35 +01:00
import { HeaderCenter, HeaderLeft } from '@components/Header'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
2021-08-29 15:25:38 +02:00
import { TabMeStackParamList } from '@utils/navigation/navigators'
2021-01-07 22:18:14 +01:00
import React from 'react'
import { useTranslation } from 'react-i18next'
2021-01-14 00:43:35 +01:00
import { Platform } from 'react-native'
2021-05-09 21:59:03 +02:00
import TabMeBookmarks from './Me/Bookmarks'
import TabMeConversations from './Me/Cconversations'
import TabMeFavourites from './Me/Favourites'
import TabMeLists from './Me/Lists'
import TabMeListsList from './Me/ListsList'
import TabMeProfile from './Me/Profile'
import TabMePush from './Me/Push'
import TabMeRoot from './Me/Root'
import TabMeSettings from './Me/Settings'
import TabMeSettingsFontsize from './Me/SettingsFontsize'
import TabMeSwitch from './Me/Switch'
2021-08-29 15:25:38 +02:00
import TabSharedRoot from './Shared/Root'
2020-11-28 17:07:30 +01:00
2021-08-29 15:25:38 +02:00
const Stack = createNativeStackNavigator<TabMeStackParamList>()
2020-11-21 13:19:05 +01:00
const TabMe = React.memo(
() => {
2021-03-28 23:31:10 +02:00
const { t } = useTranslation('screenTabs')
2020-11-24 00:18:47 +01:00
return (
<Stack.Navigator screenOptions={{ headerShadowVisible: false }}>
<Stack.Screen
name='Tab-Me-Root'
2021-05-09 21:59:03 +02:00
component={TabMeRoot}
options={{
headerShadowVisible: false,
headerStyle: { backgroundColor: 'rgba(255, 255, 255, 0)' },
headerShown: false
}}
/>
<Stack.Screen
name='Tab-Me-Bookmarks'
2021-05-09 21:59:03 +02:00
component={TabMeBookmarks}
options={({ navigation }: any) => ({
2021-03-28 23:31:10 +02:00
headerTitle: t('me.stacks.bookmarks.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-03-28 23:31:10 +02:00
<HeaderCenter content={t('me.stacks.bookmarks.name')} />
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
name='Tab-Me-Conversations'
2021-05-09 21:59:03 +02:00
component={TabMeConversations}
options={({ navigation }: any) => ({
2021-03-28 23:31:10 +02:00
headerTitle: t('me.stacks.conversations.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-03-28 23:31:10 +02:00
<HeaderCenter content={t('me.stacks.conversations.name')} />
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
name='Tab-Me-Favourites'
2021-05-09 21:59:03 +02:00
component={TabMeFavourites}
options={({ navigation }: any) => ({
2021-03-28 23:31:10 +02:00
headerTitle: t('me.stacks.favourites.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-03-28 23:31:10 +02:00
<HeaderCenter content={t('me.stacks.favourites.name')} />
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
name='Tab-Me-Lists'
2021-05-09 21:59:03 +02:00
component={TabMeLists}
options={({ navigation }: any) => ({
2021-03-28 23:31:10 +02:00
headerTitle: t('me.stacks.lists.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-03-28 23:31:10 +02:00
<HeaderCenter content={t('me.stacks.lists.name')} />
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
name='Tab-Me-Lists-List'
2021-05-09 21:59:03 +02:00
component={TabMeListsList}
options={({ route, navigation }: any) => ({
2021-03-28 23:31:10 +02:00
headerTitle: t('me.stacks.list.name', { list: route.params.title }),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter
2021-03-28 23:31:10 +02:00
content={t('me.stacks.list.name', {
list: route.params.title
})}
/>
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
2021-05-09 21:59:03 +02:00
name='Tab-Me-Profile'
component={TabMeProfile}
options={{
headerShown: false,
presentation: 'modal'
2021-05-09 21:59:03 +02:00
}}
/>
<Stack.Screen
name='Tab-Me-Push'
component={TabMePush}
2021-05-12 22:45:51 +02:00
options={({ navigation }) => ({
presentation: 'modal',
2021-05-12 22:45:51 +02:00
headerShown: true,
headerTitle: t('me.stacks.push.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter content={t('me.stacks.push.name')} />
)
}),
headerLeft: () => (
<HeaderLeft
content='ChevronDown'
onPress={() => navigation.goBack()}
/>
)
})}
/>
2021-03-10 10:22:53 +01:00
<Stack.Screen
2021-05-09 21:59:03 +02:00
name='Tab-Me-Settings'
component={TabMeSettings}
2021-03-10 10:22:53 +01:00
options={({ navigation }: any) => ({
2021-05-09 21:59:03 +02:00
headerTitle: t('me.stacks.settings.name'),
2021-03-10 10:22:53 +01:00
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-05-09 21:59:03 +02:00
<HeaderCenter content={t('me.stacks.settings.name')} />
2021-03-10 10:22:53 +01:00
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
2021-02-20 19:12:44 +01:00
<Stack.Screen
2021-05-09 21:59:03 +02:00
name='Tab-Me-Settings-Fontsize'
component={TabMeSettingsFontsize}
2021-02-20 19:12:44 +01:00
options={({ navigation }: any) => ({
2021-05-09 21:59:03 +02:00
headerTitle: t('me.stacks.fontSize.name'),
2021-02-20 19:12:44 +01:00
...(Platform.OS === 'android' && {
headerCenter: () => (
2021-05-09 21:59:03 +02:00
<HeaderCenter content={t('me.stacks.fontSize.name')} />
2021-02-20 19:12:44 +01:00
)
}),
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} />
})}
/>
<Stack.Screen
name='Tab-Me-Switch'
2021-05-09 21:59:03 +02:00
component={TabMeSwitch}
2021-05-12 22:45:51 +02:00
options={({ navigation }) => ({
presentation: 'modal',
2021-05-12 22:45:51 +02:00
headerShown: true,
headerTitle: t('me.stacks.switch.name'),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter content={t('me.stacks.switch.name')} />
)
}),
headerLeft: () => (
<HeaderLeft
content='ChevronDown'
onPress={() => navigation.goBack()}
/>
)
})}
/>
2020-11-21 13:19:05 +01:00
2021-08-29 15:25:38 +02:00
{TabSharedRoot({ Stack })}
</Stack.Navigator>
)
},
() => true
)
2020-11-21 13:19:05 +01:00
2021-01-30 01:29:15 +01:00
export default TabMe