tooot/src/screens/Compose/EditAttachment.tsx

62 lines
1.7 KiB
TypeScript
Raw Normal View History

import { HeaderLeft } from '@components/Header'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
2021-08-29 15:25:38 +02:00
import { ScreenComposeStackScreenProps } from '@utils/navigation/navigators'
2021-03-09 14:43:31 +01:00
import React, { useCallback } from 'react'
2021-01-19 01:13:45 +01:00
import { useTranslation } from 'react-i18next'
2021-03-09 14:43:31 +01:00
import { KeyboardAvoidingView, Platform } from 'react-native'
2020-12-06 12:52:29 +01:00
import { SafeAreaView } from 'react-native-safe-area-context'
2020-12-30 00:56:25 +01:00
import ComposeEditAttachmentRoot from './EditAttachment/Root'
2021-03-09 14:43:31 +01:00
import ComposeEditAttachmentSubmit from './EditAttachment/Submit'
2020-12-06 12:52:29 +01:00
const Stack = createNativeStackNavigator()
2021-08-29 15:25:38 +02:00
const ComposeEditAttachment: React.FC<ScreenComposeStackScreenProps<
2021-01-31 03:09:35 +01:00
'Screen-Compose-EditAttachment'
2021-08-29 15:25:38 +02:00
>> = ({
2020-12-06 12:52:29 +01:00
route: {
2020-12-30 00:56:25 +01:00
params: { index }
},
navigation
2020-12-06 12:52:29 +01:00
}) => {
2021-03-28 23:31:10 +02:00
const { t } = useTranslation('screenCompose')
2020-12-30 00:56:25 +01:00
const headerLeft = useCallback(
() => (
<HeaderLeft
2021-02-07 00:39:11 +01:00
type='icon'
content='ChevronDown'
2020-12-30 00:56:25 +01:00
onPress={() => navigation.goBack()}
2020-12-06 21:42:19 +01:00
/>
2020-12-30 00:56:25 +01:00
),
[]
)
const children = useCallback(
2021-03-09 14:43:31 +01:00
() => <ComposeEditAttachmentRoot index={index} />,
2020-12-30 00:56:25 +01:00
[]
)
2020-12-06 12:52:29 +01:00
return (
2021-01-14 00:43:35 +01:00
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={{ flex: 1 }}
>
2020-12-30 00:56:25 +01:00
<SafeAreaView style={{ flex: 1 }} edges={['left', 'right', 'bottom']}>
<Stack.Navigator>
2020-12-06 12:52:29 +01:00
<Stack.Screen
2021-01-30 01:29:15 +01:00
name='Screen-Compose-EditAttachment-Root'
2020-12-30 00:56:25 +01:00
children={children}
2021-02-07 00:39:11 +01:00
options={{
headerLeft,
2021-03-09 14:43:31 +01:00
headerRight: () => <ComposeEditAttachmentSubmit index={index} />,
headerTitle: t('content.editAttachment.header.title')
2021-02-07 00:39:11 +01:00
}}
2020-12-30 00:56:25 +01:00
/>
2020-12-06 12:52:29 +01:00
</Stack.Navigator>
</SafeAreaView>
</KeyboardAvoidingView>
)
}
export default ComposeEditAttachment