reduce lightbox button size on native
This commit is contained in:
@@ -19,8 +19,8 @@ export function Lightbox() {
|
|||||||
<ImageView
|
<ImageView
|
||||||
lightbox={activeLightbox}
|
lightbox={activeLightbox}
|
||||||
onRequestClose={onClose}
|
onRequestClose={onClose}
|
||||||
onPressSave={saveImageToAlbum}
|
onPressSave={uri => void saveImageToAlbum(uri)}
|
||||||
onPressShare={uri => shareImageModal({uri})}
|
onPressShare={uri => void shareImageModal({uri})}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ type Props = {
|
|||||||
| 'accessibilityHint'
|
| 'accessibilityHint'
|
||||||
>
|
>
|
||||||
|
|
||||||
const SIZE = 44
|
const SIZE = 32
|
||||||
const RADIUS = 24
|
const RADIUS = 24
|
||||||
const ICON = 24
|
const ICON = 18
|
||||||
|
|
||||||
export function CircleChromeButton({
|
export function CircleChromeButton({
|
||||||
icon: Icon,
|
icon: Icon,
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {useLingui} from '@lingui/react/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
|
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -20,7 +19,8 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
|
const t = useTheme()
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const isMomentumScrolling = useRef(false)
|
const isMomentumScrolling = useRef(false)
|
||||||
|
|
||||||
@@ -28,8 +28,14 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.root, {paddingBottom: insets.bottom + 8}]}
|
style={[
|
||||||
pointerEvents="box-none">
|
a.absolute,
|
||||||
|
a.left_0,
|
||||||
|
a.right_0,
|
||||||
|
a.bottom_0,
|
||||||
|
a.pointer_events_box_none,
|
||||||
|
{paddingBottom: insets.bottom + 8},
|
||||||
|
]}>
|
||||||
<View style={[a.mx_md, styles.altWrap]}>
|
<View style={[a.mx_md, styles.altWrap]}>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
scrollEnabled={isAltExpanded}
|
scrollEnabled={isAltExpanded}
|
||||||
@@ -42,7 +48,7 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
|||||||
contentContainerStyle={[a.px_md, a.py_sm]}>
|
contentContainerStyle={[a.px_md, a.py_sm]}>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={_(msg`Expand alt text`)}
|
accessibilityLabel={l`Expand alt text`}
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (isMomentumScrolling.current) return
|
if (isMomentumScrolling.current) return
|
||||||
@@ -55,7 +61,7 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
|||||||
<Text
|
<Text
|
||||||
emoji
|
emoji
|
||||||
selectable
|
selectable
|
||||||
style={[a.text_sm, styles.altText]}
|
style={[a.text_sm, {color: t.palette.white}]}
|
||||||
numberOfLines={isAltExpanded ? undefined : 3}>
|
numberOfLines={isAltExpanded ? undefined : 3}>
|
||||||
{altText}
|
{altText}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -67,18 +73,9 @@ export function Footer({altText, isAltExpanded, onToggleAltExpanded}: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
root: {
|
|
||||||
position: 'absolute',
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
},
|
|
||||||
altWrap: {
|
altWrap: {
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0.45)',
|
backgroundColor: 'rgba(0, 0, 0, 0.45)',
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
altText: {
|
|
||||||
color: '#fff',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {StyleSheet, View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {msg} from '@lingui/core/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
@@ -30,14 +30,17 @@ export function Header({
|
|||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
styles.root,
|
a.absolute,
|
||||||
|
a.top_0,
|
||||||
|
a.left_0,
|
||||||
|
a.right_0,
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.justify_between,
|
a.justify_between,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
a.px_md,
|
a.px_md,
|
||||||
|
a.pointer_events_box_none,
|
||||||
{paddingTop: insets.top + 8},
|
{paddingTop: insets.top + 8},
|
||||||
]}
|
]}>
|
||||||
pointerEvents="box-none">
|
|
||||||
<ImageMenu onPressShare={onPressShare} onPressSave={onPressSave} />
|
<ImageMenu onPressShare={onPressShare} onPressSave={onPressSave} />
|
||||||
<PagerDots count={imageCount} activeIndex={activeIndex} />
|
<PagerDots count={imageCount} activeIndex={activeIndex} />
|
||||||
<CircleChromeButton
|
<CircleChromeButton
|
||||||
@@ -48,12 +51,3 @@ export function Header({
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
root: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import Animated, {
|
|||||||
withSpring,
|
withSpring,
|
||||||
withTiming,
|
withTiming,
|
||||||
} from 'react-native-reanimated'
|
} from 'react-native-reanimated'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {useLingui} from '@lingui/react/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
|
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {ArrowShareRight_Stroke2_Corner2_Rounded as ShareIcon} from '#/components/icons/ArrowShareRight'
|
import {ArrowShareRight_Stroke2_Corner2_Rounded as ShareIcon} from '#/components/icons/ArrowShareRight'
|
||||||
@@ -36,7 +35,7 @@ const SPRING_IN = {damping: 18, mass: 0.6, stiffness: 240}
|
|||||||
const TIMING_OUT = {duration: 150}
|
const TIMING_OUT = {duration: 150}
|
||||||
|
|
||||||
export function ImageMenu({onPressShare, onPressSave}: Props) {
|
export function ImageMenu({onPressShare, onPressSave}: Props) {
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const triggerRef = useRef<View>(null)
|
const triggerRef = useRef<View>(null)
|
||||||
const [isMounted, setIsMounted] = useState(false)
|
const [isMounted, setIsMounted] = useState(false)
|
||||||
const [anchor, setAnchor] = useState<Anchor | null>(null)
|
const [anchor, setAnchor] = useState<Anchor | null>(null)
|
||||||
@@ -71,7 +70,7 @@ export function ImageMenu({onPressShare, onPressSave}: Props) {
|
|||||||
<CircleChromeButton
|
<CircleChromeButton
|
||||||
icon={DotsIcon}
|
icon={DotsIcon}
|
||||||
iconStyle={{transform: [{rotate: '90deg'}]}}
|
iconStyle={{transform: [{rotate: '90deg'}]}}
|
||||||
label={_(msg`Image options`)}
|
label={l`Image options`}
|
||||||
onPress={open}
|
onPress={open}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -83,21 +82,21 @@ export function ImageMenu({onPressShare, onPressSave}: Props) {
|
|||||||
statusBarTranslucent>
|
statusBarTranslucent>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={_(msg`Close menu`)}
|
accessibilityLabel={l`Close menu`}
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
style={StyleSheet.absoluteFill}
|
style={[a.absolute, a.inset_0]}
|
||||||
onPress={close}
|
onPress={close}
|
||||||
/>
|
/>
|
||||||
{anchor && (
|
{anchor && (
|
||||||
<MenuCard anchor={anchor} progress={progress}>
|
<MenuCard anchor={anchor} progress={progress}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={ShareIcon}
|
icon={ShareIcon}
|
||||||
label={_(msg`Share image`)}
|
label={l`Share image`}
|
||||||
onPress={() => runAction(onPressShare)}
|
onPress={() => runAction(onPressShare)}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={DownloadIcon}
|
icon={DownloadIcon}
|
||||||
label={_(msg`Save image`)}
|
label={l`Save image`}
|
||||||
onPress={() => runAction(onPressSave)}
|
onPress={() => runAction(onPressSave)}
|
||||||
/>
|
/>
|
||||||
</MenuCard>
|
</MenuCard>
|
||||||
|
|||||||
Reference in New Issue
Block a user