Fix word wrapping in image menu on Android (#10577)
This commit is contained in:
@@ -8,10 +8,9 @@ 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 {android, atoms as a, ios} from '#/alf'
|
||||||
import {ArrowShareRight_Stroke2_Corner2_Rounded as ShareIcon} from '#/components/icons/ArrowShareRight'
|
import {ArrowShareRight_Stroke2_Corner2_Rounded as ShareIcon} from '#/components/icons/ArrowShareRight'
|
||||||
import {type Props as IconProps} from '#/components/icons/common'
|
import {type Props as IconProps} from '#/components/icons/common'
|
||||||
import {DotGrid3x1_Stroke2_Corner0_Rounded as DotsIcon} from '#/components/icons/DotGrid'
|
import {DotGrid3x1_Stroke2_Corner0_Rounded as DotsIcon} from '#/components/icons/DotGrid'
|
||||||
@@ -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,7 +82,7 @@ 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={StyleSheet.absoluteFill}
|
||||||
onPress={close}
|
onPress={close}
|
||||||
@@ -92,12 +91,12 @@ export function ImageMenu({onPressShare, onPressSave}: Props) {
|
|||||||
<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>
|
||||||
@@ -126,6 +125,8 @@ function MenuCard({
|
|||||||
style={[
|
style={[
|
||||||
a.absolute,
|
a.absolute,
|
||||||
styles.card,
|
styles.card,
|
||||||
|
android({alignSelf: 'flex-start'}),
|
||||||
|
ios({width: MENU_WIDTH}),
|
||||||
{
|
{
|
||||||
top: anchor.y + anchor.height + GAP,
|
top: anchor.y + anchor.height + GAP,
|
||||||
left: anchor.x,
|
left: anchor.x,
|
||||||
@@ -162,7 +163,6 @@ function MenuItem({
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
card: {
|
card: {
|
||||||
width: MENU_WIDTH,
|
|
||||||
padding: 8,
|
padding: 8,
|
||||||
borderRadius: 16,
|
borderRadius: 16,
|
||||||
borderWidth: 0.5,
|
borderWidth: 0.5,
|
||||||
|
|||||||
Reference in New Issue
Block a user