tooot/src/screens/Compose/DraftsList.tsx

60 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-02-07 00:39:11 +01:00
import { HeaderCenter, HeaderLeft } from '@components/Header'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
2021-02-07 00:39:11 +01:00
import { StackScreenProps } from '@react-navigation/stack'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import ComposeDraftsListRoot from './DraftsList/Root'
const Stack = createNativeStackNavigator()
export type ScreenComposeEditAttachmentProp = StackScreenProps<
Nav.ScreenComposeStackParamList,
'Screen-Compose-DraftsList'
>
const ComposeDraftsList: React.FC<ScreenComposeEditAttachmentProp> = ({
route: {
params: { timestamp }
},
navigation
}) => {
2021-03-28 23:31:10 +02:00
const { t } = useTranslation('screenCompose')
2021-02-07 00:39:11 +01:00
const children = useCallback(
() => <ComposeDraftsListRoot timestamp={timestamp} />,
[]
)
const headerLeft = useCallback(
() => (
<HeaderLeft
type='icon'
content='ChevronDown'
onPress={() => navigation.goBack()}
/>
),
[]
)
return (
<Stack.Navigator>
2021-02-07 00:39:11 +01:00
<Stack.Screen
name='Screen-Compose-EditAttachment-Root'
children={children}
options={{
headerLeft,
headerTitle: t('content.draftsList.header.title'),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter content={t('content.draftsList.header.title')} />
)
}),
headerShadowVisible: false
2021-02-07 00:39:11 +01:00
}}
/>
</Stack.Navigator>
)
}
export default ComposeDraftsList