tooot/src/screens/Tabs/Notifications.tsx

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-01-14 00:43:35 +01:00
import { HeaderCenter } from '@components/Header'
2020-12-13 14:04:25 +01:00
import Timeline from '@components/Timelines/Timeline'
2021-01-30 01:29:15 +01:00
import sharedScreens from '@screens/Tabs/Shared/sharedScreens'
2021-01-07 19:13:09 +01:00
import { getLocalActiveIndex } from '@utils/slices/instancesSlice'
import React from 'react'
import { useTranslation } from 'react-i18next'
2021-01-14 00:43:35 +01:00
import { Platform } from 'react-native'
2021-01-07 19:13:09 +01:00
import { createNativeStackNavigator } from 'react-native-screens/native-stack'
import { useSelector } from 'react-redux'
2020-10-24 18:07:09 +02:00
2021-01-30 01:29:15 +01:00
const Stack = createNativeStackNavigator<Nav.TabNotificationsStackParamList>()
2020-10-23 09:22:17 +02:00
2021-01-30 01:29:15 +01:00
const TabNotifications: React.FC = () => {
const { t } = useTranslation()
2021-01-07 19:13:09 +01:00
const localActiveIndex = useSelector(getLocalActiveIndex)
2020-10-24 18:07:09 +02:00
return (
<Stack.Navigator
2020-12-25 21:51:46 +01:00
screenOptions={{
2021-01-14 00:43:35 +01:00
headerLeft: () => null,
2020-12-25 21:51:46 +01:00
headerTitle: t('notifications:heading'),
2021-01-14 00:43:35 +01:00
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter content={t('notifications:heading')} />
)
}),
2021-01-13 01:03:46 +01:00
headerHideShadow: true,
headerTopInsetEnabled: false
2020-12-25 21:51:46 +01:00
}}
>
2021-01-30 01:29:15 +01:00
<Stack.Screen name='Tab-Notifications-Root'>
2021-01-07 19:13:09 +01:00
{() =>
localActiveIndex !== null ? <Timeline page='Notifications' /> : null
}
2020-10-24 18:07:09 +02:00
</Stack.Screen>
2020-10-30 20:03:44 +01:00
2021-01-24 02:25:43 +01:00
{sharedScreens(Stack as any)}
2020-10-24 18:07:09 +02:00
</Stack.Navigator>
)
2020-10-23 09:22:17 +02:00
}
2020-10-31 21:04:46 +01:00
2021-01-30 01:29:15 +01:00
export default TabNotifications