Dimming images for dark mode

This commit is contained in:
xmflsct 2023-01-29 17:28:49 +01:00
parent e447a91cfb
commit 752d33d5b3
11 changed files with 23 additions and 13 deletions

View File

@ -45,6 +45,7 @@ const ComponentAccount: React.FC<PropsWithChildren & Props> = ({ account, props,
borderRadius: 8,
marginRight: StyleConstants.Spacing.S
}}
dim
/>
<View style={{ flex: 1 }}>
<CustomText numberOfLines={1}>

View File

@ -38,6 +38,7 @@ export interface Props {
height: number
}>
>
dim?: boolean
}
const GracefullyImage = ({
@ -50,10 +51,11 @@ const GracefullyImage = ({
onPress,
style,
imageStyle,
setImageDimensions
setImageDimensions,
dim
}: Props) => {
const { reduceMotionEnabled } = useAccessibility()
const { colors } = useTheme()
const { colors, theme } = useTheme()
const [imageLoaded, setImageLoaded] = useState(false)
const [currentUri, setCurrentUri] = useState<string | undefined>(uri.original || uri.remote)
@ -111,6 +113,14 @@ const GracefullyImage = ({
}}
/>
{blurhashView()}
{dim && theme !== 'light' ? (
<View
style={[
styles.placeholder,
{ backgroundColor: 'black', opacity: theme === 'dark_lighter' ? 0.18 : 0.36 }
]}
/>
) : null}
</Pressable>
)
}

View File

@ -88,6 +88,7 @@ const TimelineConversation: React.FC<Props> = ({ conversation, queryKey, highlig
: StyleConstants.Avatar.M
}}
style={{ flex: 1, flexBasis: '50%' }}
dim
/>
))}
</View>

View File

@ -83,11 +83,9 @@ const AttachmentAudio: React.FC<Props> = ({ total, index, sensitiveShown, audio
<>
{audio.preview_url ? (
<GracefullyImage
uri={{
original: audio.preview_url,
remote: audio.preview_remote_url
}}
uri={{ original: audio.preview_url, remote: audio.preview_remote_url }}
style={styles.background}
dim
/>
) : null}
<Button

View File

@ -39,6 +39,7 @@ const AttachmentImage = ({
blurhash={image.blurhash}
onPress={() => navigateToImagesViewer(image.id)}
style={{ aspectRatio: aspectRatio({ total, index, ...image.meta?.original }) }}
dim
/>
</View>
<AttachmentAltText sensitiveShown={sensitiveShown} text={image.description} />

View File

@ -31,8 +31,7 @@ const TimelineAvatar: React.FC<Props> = ({ account }) => {
})
})}
onPress={() =>
!disableOnPress &&
navigation.push('Tab-Shared-Account', { account: actualAccount })
!disableOnPress && navigation.push('Tab-Shared-Account', { account: actualAccount })
}
uri={{ original: actualAccount.avatar, static: actualAccount.avatar_static }}
dimension={
@ -51,6 +50,7 @@ const TimelineAvatar: React.FC<Props> = ({ account }) => {
overflow: 'hidden',
marginRight: StyleConstants.Spacing.S
}}
dim
/>
)
}

View File

@ -86,6 +86,7 @@ const TimelineCard: React.FC = () => {
blurhash={status.card.blurhash}
style={{ flexBasis: StyleConstants.Font.LineHeight.M * 5 }}
imageStyle={{ borderTopLeftRadius: 6, borderBottomLeftRadius: 6 }}
dim
/>
) : null}
<View style={{ flex: 1, padding: StyleConstants.Spacing.S }}>

View File

@ -93,6 +93,7 @@ const AccountAttachments: React.FC = () => {
dimension={{ width: width, height: width }}
style={{ marginLeft: StyleConstants.Spacing.Global.PagePadding }}
onPress={() => navigation.push('Tab-Shared-Toot', { toot: item })}
dim
/>
)
}

View File

@ -28,6 +28,7 @@ const AccountHeader: React.FC = () => {
)
}
}}
dim
/>
)
}

View File

@ -42,6 +42,7 @@ const AccountInformationAvatar: React.FC = () => {
}
}
}}
dim
/>
)
}

View File

@ -89,11 +89,6 @@ const ScreenTabs = () => {
name='Tab-Me'
component={TabMe}
listeners={({ navigation }) => ({
tabPress: () => {
if (navigation.isFocused()) {
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Switch' })
}
},
tabLongPress: () => {
haptics('Light')
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Root' })