mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Dimming images for dark mode
This commit is contained in:
@ -45,6 +45,7 @@ const ComponentAccount: React.FC<PropsWithChildren & Props> = ({ account, props,
|
|||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
marginRight: StyleConstants.Spacing.S
|
marginRight: StyleConstants.Spacing.S
|
||||||
}}
|
}}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<CustomText numberOfLines={1}>
|
<CustomText numberOfLines={1}>
|
||||||
|
@ -38,6 +38,7 @@ export interface Props {
|
|||||||
height: number
|
height: number
|
||||||
}>
|
}>
|
||||||
>
|
>
|
||||||
|
dim?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const GracefullyImage = ({
|
const GracefullyImage = ({
|
||||||
@ -50,10 +51,11 @@ const GracefullyImage = ({
|
|||||||
onPress,
|
onPress,
|
||||||
style,
|
style,
|
||||||
imageStyle,
|
imageStyle,
|
||||||
setImageDimensions
|
setImageDimensions,
|
||||||
|
dim
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { reduceMotionEnabled } = useAccessibility()
|
const { reduceMotionEnabled } = useAccessibility()
|
||||||
const { colors } = useTheme()
|
const { colors, theme } = useTheme()
|
||||||
const [imageLoaded, setImageLoaded] = useState(false)
|
const [imageLoaded, setImageLoaded] = useState(false)
|
||||||
|
|
||||||
const [currentUri, setCurrentUri] = useState<string | undefined>(uri.original || uri.remote)
|
const [currentUri, setCurrentUri] = useState<string | undefined>(uri.original || uri.remote)
|
||||||
@ -111,6 +113,14 @@ const GracefullyImage = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{blurhashView()}
|
{blurhashView()}
|
||||||
|
{dim && theme !== 'light' ? (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.placeholder,
|
||||||
|
{ backgroundColor: 'black', opacity: theme === 'dark_lighter' ? 0.18 : 0.36 }
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ const TimelineConversation: React.FC<Props> = ({ conversation, queryKey, highlig
|
|||||||
: StyleConstants.Avatar.M
|
: StyleConstants.Avatar.M
|
||||||
}}
|
}}
|
||||||
style={{ flex: 1, flexBasis: '50%' }}
|
style={{ flex: 1, flexBasis: '50%' }}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
|
@ -83,11 +83,9 @@ const AttachmentAudio: React.FC<Props> = ({ total, index, sensitiveShown, audio
|
|||||||
<>
|
<>
|
||||||
{audio.preview_url ? (
|
{audio.preview_url ? (
|
||||||
<GracefullyImage
|
<GracefullyImage
|
||||||
uri={{
|
uri={{ original: audio.preview_url, remote: audio.preview_remote_url }}
|
||||||
original: audio.preview_url,
|
|
||||||
remote: audio.preview_remote_url
|
|
||||||
}}
|
|
||||||
style={styles.background}
|
style={styles.background}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<Button
|
<Button
|
||||||
|
@ -39,6 +39,7 @@ const AttachmentImage = ({
|
|||||||
blurhash={image.blurhash}
|
blurhash={image.blurhash}
|
||||||
onPress={() => navigateToImagesViewer(image.id)}
|
onPress={() => navigateToImagesViewer(image.id)}
|
||||||
style={{ aspectRatio: aspectRatio({ total, index, ...image.meta?.original }) }}
|
style={{ aspectRatio: aspectRatio({ total, index, ...image.meta?.original }) }}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<AttachmentAltText sensitiveShown={sensitiveShown} text={image.description} />
|
<AttachmentAltText sensitiveShown={sensitiveShown} text={image.description} />
|
||||||
|
@ -31,8 +31,7 @@ const TimelineAvatar: React.FC<Props> = ({ account }) => {
|
|||||||
})
|
})
|
||||||
})}
|
})}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
!disableOnPress &&
|
!disableOnPress && navigation.push('Tab-Shared-Account', { account: actualAccount })
|
||||||
navigation.push('Tab-Shared-Account', { account: actualAccount })
|
|
||||||
}
|
}
|
||||||
uri={{ original: actualAccount.avatar, static: actualAccount.avatar_static }}
|
uri={{ original: actualAccount.avatar, static: actualAccount.avatar_static }}
|
||||||
dimension={
|
dimension={
|
||||||
@ -51,6 +50,7 @@ const TimelineAvatar: React.FC<Props> = ({ account }) => {
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
marginRight: StyleConstants.Spacing.S
|
marginRight: StyleConstants.Spacing.S
|
||||||
}}
|
}}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ const TimelineCard: React.FC = () => {
|
|||||||
blurhash={status.card.blurhash}
|
blurhash={status.card.blurhash}
|
||||||
style={{ flexBasis: StyleConstants.Font.LineHeight.M * 5 }}
|
style={{ flexBasis: StyleConstants.Font.LineHeight.M * 5 }}
|
||||||
imageStyle={{ borderTopLeftRadius: 6, borderBottomLeftRadius: 6 }}
|
imageStyle={{ borderTopLeftRadius: 6, borderBottomLeftRadius: 6 }}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<View style={{ flex: 1, padding: StyleConstants.Spacing.S }}>
|
<View style={{ flex: 1, padding: StyleConstants.Spacing.S }}>
|
||||||
|
@ -93,6 +93,7 @@ const AccountAttachments: React.FC = () => {
|
|||||||
dimension={{ width: width, height: width }}
|
dimension={{ width: width, height: width }}
|
||||||
style={{ marginLeft: StyleConstants.Spacing.Global.PagePadding }}
|
style={{ marginLeft: StyleConstants.Spacing.Global.PagePadding }}
|
||||||
onPress={() => navigation.push('Tab-Shared-Toot', { toot: item })}
|
onPress={() => navigation.push('Tab-Shared-Toot', { toot: item })}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ const AccountHeader: React.FC = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ const AccountInformationAvatar: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
dim
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -89,11 +89,6 @@ const ScreenTabs = () => {
|
|||||||
name='Tab-Me'
|
name='Tab-Me'
|
||||||
component={TabMe}
|
component={TabMe}
|
||||||
listeners={({ navigation }) => ({
|
listeners={({ navigation }) => ({
|
||||||
tabPress: () => {
|
|
||||||
if (navigation.isFocused()) {
|
|
||||||
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Switch' })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tabLongPress: () => {
|
tabLongPress: () => {
|
||||||
haptics('Light')
|
haptics('Light')
|
||||||
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Root' })
|
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Root' })
|
||||||
|
Reference in New Issue
Block a user