diff --git a/src/components/Lightbox/Lightbox.tsx b/src/components/Lightbox/Lightbox.tsx index c283cc89cb..d5f864fe30 100644 --- a/src/components/Lightbox/Lightbox.tsx +++ b/src/components/Lightbox/Lightbox.tsx @@ -19,8 +19,8 @@ export function Lightbox() { shareImageModal({uri})} + onPressSave={uri => void saveImageToAlbum(uri)} + onPressShare={uri => void shareImageModal({uri})} /> ) } diff --git a/src/components/Lightbox/Lightbox.web.tsx b/src/components/Lightbox/Lightbox.web.tsx index 4f88412d9a..641b2c3402 100644 --- a/src/components/Lightbox/Lightbox.web.tsx +++ b/src/components/Lightbox/Lightbox.web.tsx @@ -1,9 +1,7 @@ import {useCallback, useEffect, useRef, useState} from 'react' import {Pressable, StyleSheet, View} from 'react-native' import {Image} from 'expo-image' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' +import {Trans, useLingui} from '@lingui/react/macro' import {FocusGuards, FocusScope} from 'radix-ui/internal' import {RemoveScrollBar} from 'react-remove-scroll-bar' @@ -67,12 +65,12 @@ function LightboxContainer({ children: React.ReactNode handleBackgroundPress: () => void }) { - const {_} = useLingui() + const {t: l} = useLingui() FocusGuards.useFocusGuards() return ( @@ -81,7 +79,7 @@ function LightboxContainer({
{children}
@@ -100,7 +98,7 @@ function LightboxGallery({ onClose: () => void }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {reduceMotionEnabled} = useA11y() const [index, setIndex] = useState(initialIndex) const [hasAnyLoaded, setAnyHasLoaded] = useState(false) @@ -196,7 +194,7 @@ function LightboxGallery({ ]} hoverStyle={styles.blurredBackdropHover} color="secondary" - label={_(msg`Previous image`)} + label={l`Previous image`} shape="round" size={gtPhone ? 'large' : 'small'}> { setAltExpanded(!isAltExpanded) }}> @@ -254,11 +250,11 @@ function LightboxGallery({ ) : null} {imgs.length > 1 && (
- {_(msg`Image ${index + 1} of ${imgs.length}`)} + {l`Image ${index + 1} of ${imgs.length}`}
)} - + {({props}) => ( )} @@ -274,7 +270,7 @@ function LightboxGallery({ { const url = img.uri if ( @@ -293,9 +289,9 @@ function LightboxGallery({ ) { try { await navigator.clipboard.writeText(url) - Toast.show(_(msg`Link copied to clipboard`)) + Toast.show(l`Link copied to clipboard`) } catch { - Toast.show(_(msg`Failed to copy link`), {type: 'error'}) + Toast.show(l`Failed to copy link`, {type: 'error'}) } } }}> @@ -305,14 +301,14 @@ function LightboxGallery({ { saveImageToMediaLibrary({uri: img.uri}).then( () => { - Toast.show(_(msg`Image saved`)) + Toast.show(l`Image saved`) }, () => { - Toast.show(_(msg`Failed to save image`), {type: 'error'}) + Toast.show(l`Failed to save image`, {type: 'error'}) }, ) }}> @@ -327,7 +323,7 @@ function LightboxGallery({ diff --git a/src/components/Lightbox/chrome/CircleChromeButton.tsx b/src/components/Lightbox/chrome/CircleChromeButton.tsx index afc30c5859..9b31266bd3 100644 --- a/src/components/Lightbox/chrome/CircleChromeButton.tsx +++ b/src/components/Lightbox/chrome/CircleChromeButton.tsx @@ -8,7 +8,7 @@ import { } from 'react-native' import {BlurView} from 'expo-blur' -import {HITSLOP_10} from '#/lib/constants' +import {HITSLOP_20} from '#/lib/constants' import {type Props as IconProps} from '#/components/icons/common' type Props = { @@ -27,9 +27,9 @@ type Props = { | 'accessibilityHint' > -const SIZE = 44 -const RADIUS = 24 -const ICON = 24 +const SIZE = 32 +const RADIUS = SIZE / 2 +const ICON = 18 export function CircleChromeButton({ icon: Icon, @@ -45,7 +45,7 @@ export function CircleChromeButton({ accessibilityRole="button" accessibilityLabel={label} accessibilityHint="" - hitSlop={HITSLOP_10} + hitSlop={HITSLOP_20} onPress={onPress} testID={testID} style={({pressed}) => [styles.root, pressed && styles.pressed]}> diff --git a/src/components/Lightbox/chrome/Footer.tsx b/src/components/Lightbox/chrome/Footer.tsx index 14b5e1bd2c..8e477d7e46 100644 --- a/src/components/Lightbox/chrome/Footer.tsx +++ b/src/components/Lightbox/chrome/Footer.tsx @@ -7,10 +7,9 @@ import { View, } from 'react-native' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' -import {atoms as a} from '#/alf' +import {atoms as a, useTheme} from '#/alf' import {Text} from '#/components/Typography' type Props = { @@ -20,7 +19,8 @@ type Props = { } export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() + const t = useTheme() const insets = useSafeAreaInsets() const isMomentumScrolling = useRef(false) @@ -28,8 +28,14 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) { return ( + style={[ + a.absolute, + a.left_0, + a.right_0, + a.bottom_0, + a.pointer_events_box_none, + {paddingBottom: insets.bottom + 8}, + ]}> { if (isMomentumScrolling.current) return @@ -55,7 +61,7 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) { {altText} @@ -67,18 +73,9 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) { } const styles = StyleSheet.create({ - root: { - position: 'absolute', - bottom: 0, - left: 0, - right: 0, - }, altWrap: { backgroundColor: 'rgba(0, 0, 0, 0.45)', borderRadius: 12, overflow: 'hidden', }, - altText: { - color: '#fff', - }, }) diff --git a/src/components/Lightbox/chrome/Header.tsx b/src/components/Lightbox/chrome/Header.tsx index 3504526ae3..98dff40ba4 100644 --- a/src/components/Lightbox/chrome/Header.tsx +++ b/src/components/Lightbox/chrome/Header.tsx @@ -1,7 +1,6 @@ -import {StyleSheet, View} from 'react-native' +import {View} from 'react-native' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {atoms as a} from '#/alf' import {TimesLarge_Stroke2_Corner0_Rounded as CloseIcon} from '#/components/icons/Times' @@ -24,36 +23,30 @@ export function Header({ imageCount, activeIndex, }: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const insets = useSafeAreaInsets() return ( + ]}> ) } - -const styles = StyleSheet.create({ - root: { - position: 'absolute', - top: 0, - left: 0, - right: 0, - }, -}) diff --git a/src/components/Lightbox/chrome/ImageMenu.tsx b/src/components/Lightbox/chrome/ImageMenu.tsx index 9e1838c593..8daa9a5b84 100644 --- a/src/components/Lightbox/chrome/ImageMenu.tsx +++ b/src/components/Lightbox/chrome/ImageMenu.tsx @@ -84,7 +84,7 @@ export function ImageMenu({onPressShare, onPressSave}: Props) { accessibilityRole="button" accessibilityLabel={l`Close menu`} accessibilityHint="" - style={StyleSheet.absoluteFill} + style={[a.absolute, a.inset_0]} onPress={close} /> {anchor && (