1
0
mirror of https://github.com/tooot-app/app synced 2025-04-10 00:21:11 +02:00
This commit is contained in:
xmflsct 2022-12-12 21:02:17 +01:00
parent 6936e8009a
commit 91be219ff3
2 changed files with 24 additions and 32 deletions

View File

@ -112,6 +112,17 @@ const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
return ( return (
<> <>
<CustomText
fontStyle='M'
style={{
color: colors.primaryDefault,
padding: StyleConstants.Spacing.Global.PagePadding,
paddingTop: 0
}}
fontWeight='Bold'
>
{t('content.editAttachment.content.imageFocus')}
</CustomText>
<View style={{ overflow: 'hidden', flex: 1, alignItems: 'center' }}> <View style={{ overflow: 'hidden', flex: 1, alignItems: 'center' }}>
<Image <Image
style={{ style={{
@ -155,17 +166,6 @@ const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
/> />
</GestureDetector> </GestureDetector>
</View> </View>
{screenReaderEnabled ? null : (
<CustomText
fontStyle='M'
style={{
padding: StyleConstants.Spacing.Global.PagePadding,
color: colors.primaryDefault
}}
>
{t('content.editAttachment.content.imageFocus')}
</CustomText>
)}
</> </>
) )
} }

View File

@ -2,7 +2,7 @@ import CustomText from '@components/Text'
import AttachmentVideo from '@components/Timeline/Shared/Attachment/Video' import AttachmentVideo from '@components/Timeline/Shared/Attachment/Video'
import { StyleConstants } from '@utils/styles/constants' import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager' import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext, useRef } from 'react' import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { ScrollView, StyleSheet, TextInput, View } from 'react-native' import { ScrollView, StyleSheet, TextInput, View } from 'react-native'
import ComposeContext from '../utils/createContext' import ComposeContext from '../utils/createContext'
@ -34,10 +34,10 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
video={ video={
video.local video.local
? ({ ? ({
url: video.local.uri, url: video.local.uri,
preview_url: video.local.thumbnail, preview_url: video.local.thumbnail,
blurhash: video.remote?.blurhash blurhash: video.remote?.blurhash
} as Mastodon.AttachmentVideo) } as Mastodon.AttachmentVideo)
: (video.remote as Mastodon.AttachmentVideo) : (video.remote as Mastodon.AttachmentVideo)
} }
/> />
@ -47,45 +47,36 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
return null return null
} }
const scrollViewRef = useRef<ScrollView>(null)
return ( return (
<ScrollView ref={scrollViewRef}> <ScrollView>
{mediaDisplay()} <View style={{ padding: StyleConstants.Spacing.Global.PagePadding, paddingBottom: 0 }}>
<View style={{ padding: StyleConstants.Spacing.Global.PagePadding }}> <CustomText fontStyle='M' style={{ color: colors.primaryDefault }} fontWeight='Bold'>
<CustomText
fontStyle='M'
style={{ color: colors.primaryDefault }}
fontWeight='Bold'
>
{t('content.editAttachment.content.altText.heading')} {t('content.editAttachment.content.altText.heading')}
</CustomText> </CustomText>
<TextInput <TextInput
style={{ style={{
height: 200, height: StyleConstants.Font.Size.M * 11 + StyleConstants.Spacing.Global.PagePadding * 2,
...StyleConstants.FontStyle.M, ...StyleConstants.FontStyle.M,
marginTop: StyleConstants.Spacing.M, marginTop: StyleConstants.Spacing.M,
marginBottom: StyleConstants.Spacing.S, marginBottom: StyleConstants.Spacing.S,
padding: StyleConstants.Spacing.Global.PagePadding, padding: StyleConstants.Spacing.Global.PagePadding,
paddingTop: StyleConstants.Spacing.S * 1.5,
borderWidth: StyleSheet.hairlineWidth, borderWidth: StyleSheet.hairlineWidth,
borderColor: colors.border, borderColor: colors.border,
color: colors.primaryDefault color: colors.primaryDefault
}} }}
onFocus={() => scrollViewRef.current?.scrollToEnd()}
maxLength={1500} maxLength={1500}
multiline multiline
onChangeText={(e) => onChangeText={e =>
composeDispatch({ composeDispatch({
type: 'attachment/edit', type: 'attachment/edit',
payload: { payload: {
...theAttachment, ...theAttachment,
description: e description: e
} }
})} })
}
placeholder={t('content.editAttachment.content.altText.placeholder')} placeholder={t('content.editAttachment.content.altText.placeholder')}
placeholderTextColor={colors.secondary} placeholderTextColor={colors.secondary}
scrollEnabled
value={theAttachment.description} value={theAttachment.description}
keyboardAppearance={mode} keyboardAppearance={mode}
/> />
@ -101,6 +92,7 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
{theAttachment.description?.length || 0} / 1500 {theAttachment.description?.length || 0} / 1500
</CustomText> </CustomText>
</View> </View>
{mediaDisplay()}
</ScrollView> </ScrollView>
) )
} }