import { HeaderLeft } from '@components/Header' import { StackNavigationState, TypedNavigator } from '@react-navigation/native' import { StackScreenProps } from '@react-navigation/stack' import ScreenSharedAccount from '@screens/Shared/Account' import ScreenSharedAnnouncements from '@screens/Shared/Announcements' import Compose from '@screens/Shared/Compose' import ScreenSharedHashtag from '@screens/Shared/Hashtag' import ScreenSharedImagesViewer from '@screens/Shared/ImagesViewer' import ScreenSharedRelationships from '@screens/Shared/Relationships' import ScreenSharedSearch from '@screens/Shared/Search' import ScreenSharedToot from '@screens/Shared/Toot' import React from 'react' import { useTranslation } from 'react-i18next' import { NativeStackNavigationOptions } from 'react-native-screens/lib/typescript' import { NativeStackNavigationEventMap, NativeStackNavigatorProps } from 'react-native-screens/lib/typescript/types' type BaseScreens = | Nav.LocalStackParamList | Nav.RemoteStackParamList | Nav.NotificationsStackParamList | Nav.MeStackParamList export type SharedAccountProp = StackScreenProps< BaseScreens, 'Screen-Shared-Account' > export type SharedAnnouncementsProp = StackScreenProps< BaseScreens, 'Screen-Shared-Announcements' > export type SharedComposeProp = StackScreenProps< BaseScreens, 'Screen-Shared-Compose' > export type SharedHashtagProp = StackScreenProps< BaseScreens, 'Screen-Shared-Hashtag' > export type SharedImagesViewerProp = StackScreenProps< BaseScreens, 'Screen-Shared-ImagesViewer' > export type SharedRelationshipsProp = StackScreenProps< BaseScreens, 'Screen-Shared-Relationships' > export type SharedTootProp = StackScreenProps const sharedScreens = ( Stack: TypedNavigator< BaseScreens, StackNavigationState>, NativeStackNavigationOptions, NativeStackNavigationEventMap, ({ initialRouteName, children, screenOptions, ...rest }: NativeStackNavigatorProps) => JSX.Element > ) => { const { t } = useTranslation() return [ { return { headerTranslucent: true, headerStyle: { backgroundColor: `rgba(255, 255, 255, 0)` }, headerCenter: () => null, headerLeft: () => navigation.goBack()} /> } }} />, , , ({ title: `#${decodeURIComponent(route.params.hashtag)}`, headerLeft: () => navigation.goBack()} /> })} />, , ({ title: route.params.account.display_name || route.params.account.name, headerLeft: () => navigation.goBack()} /> })} />, ({ headerLeft: () => navigation.goBack()} /> })} />, ({ title: t('sharedToot:heading'), headerLeft: () => navigation.goBack()} /> })} /> ] } export default sharedScreens