import { HeaderCenter } from '@components/Header' import Timeline from '@components/Timeline' import TimelineNotifications from '@components/Timeline/Notifications' import sharedScreens from '@screens/Tabs/Shared/sharedScreens' import { QueryKeyTimeline } from '@utils/queryHooks/timeline' import { updateInstanceNotification } from '@utils/slices/instancesSlice' import React, { useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { Platform, ViewToken } from 'react-native' import { createNativeStackNavigator } from 'react-native-screens/native-stack' import { useDispatch } from 'react-redux' const Stack = createNativeStackNavigator() const TabNotifications = React.memo( () => { const { t } = useTranslation() const dispatch = useDispatch() const screenOptions = useMemo( () => ({ headerTitle: t('notifications:heading'), ...(Platform.OS === 'android' && { headerCenter: () => ( ) }), headerHideShadow: true, headerTopInsetEnabled: false }), [] ) const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Notifications' }] const renderItem = useCallback( ({ item }) => ( ), [] ) const children = useCallback( ({ navigation }) => ( { if ( navigation.isFocused() && viewableItems.length && viewableItems[0].index === 0 ) { dispatch( updateInstanceNotification({ readTime: viewableItems[0].item.created_at }) ) } }, viewabilityConfig: { minimumViewTime: 100, itemVisiblePercentThreshold: 60 } } ] }} /> ), [] ) return ( {sharedScreens(Stack as any)} ) }, () => true ) export default TabNotifications