From e38a45ffb2749db116f84faad051494312515c1d Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 3 Jun 2022 23:18:24 +0200 Subject: [PATCH] Fixed #315 --- src/components/Button.tsx | 3 ++ .../Timeline/Shared/Attachment/AltText.tsx | 38 ++++++++++++++ .../Timeline/Shared/Attachment/Audio.tsx | 5 ++ .../Timeline/Shared/Attachment/Image.tsx | 9 +++- .../Shared/Attachment/Unsupported.tsx | 5 ++ .../Timeline/Shared/Attachment/Video.tsx | 51 +++++++++---------- src/i18n/en/screens/actions.json | 5 +- src/screens/Actions.tsx | 5 +- src/screens/Actions/AltText.tsx | 44 ++++++++++++++++ src/screens/Actions/NotificationsFilter.tsx | 13 ++--- src/utils/navigation/navigators.ts | 4 ++ 11 files changed, 140 insertions(+), 42 deletions(-) create mode 100644 src/components/Timeline/Shared/Attachment/AltText.tsx create mode 100644 src/screens/Actions/AltText.tsx diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 579134b7..80049c5d 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -29,6 +29,7 @@ export interface Props { strokeWidth?: number size?: 'S' | 'M' | 'L' + fontBold?: boolean spacing?: 'XS' | 'S' | 'M' | 'L' round?: boolean overlay?: boolean @@ -48,6 +49,7 @@ const Button: React.FC = ({ disabled = false, strokeWidth, size = 'M', + fontBold = false, spacing = 'S', round = false, overlay = false, @@ -122,6 +124,7 @@ const Button: React.FC = ({ StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1), opacity: loading ? 0 : 1 }} + fontWeight={fontBold ? 'Bold' : 'Normal'} children={content} testID='text' /> diff --git a/src/components/Timeline/Shared/Attachment/AltText.tsx b/src/components/Timeline/Shared/Attachment/AltText.tsx new file mode 100644 index 00000000..59775ac5 --- /dev/null +++ b/src/components/Timeline/Shared/Attachment/AltText.tsx @@ -0,0 +1,38 @@ +import Button from '@components/Button' +import { useNavigation } from '@react-navigation/native' +import { StackNavigationProp } from '@react-navigation/stack' +import { RootStackParamList } from '@utils/navigation/navigators' +import { StyleConstants } from '@utils/styles/constants' + +export interface Props { + sensitiveShown: boolean + text?: string +} + +const AttachmentAltText: React.FC = ({ sensitiveShown, text }) => { + if (!text) { + return null + } + + const navigation = useNavigation>() + + return !sensitiveShown ? ( +