From 13bc8da818f9448a6c6bec953e04c04085e4eda6 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 20 Apr 2026 12:25:41 +0300 Subject: [PATCH] expose as PeekMenu --- src/components/PeekMenu/index.ios.tsx | 12 +++++ src/components/PeekMenu/index.tsx | 54 +++++++++++++++++++ .../Post/Embed/ImageContextMenu.tsx | 37 ++++++------- 3 files changed, 83 insertions(+), 20 deletions(-) create mode 100644 src/components/PeekMenu/index.ios.tsx create mode 100644 src/components/PeekMenu/index.tsx diff --git a/src/components/PeekMenu/index.ios.tsx b/src/components/PeekMenu/index.ios.tsx new file mode 100644 index 0000000000..3e2f025542 --- /dev/null +++ b/src/components/PeekMenu/index.ios.tsx @@ -0,0 +1,12 @@ +export type { + MenuItemSpec, + PreviewContent, +} from '../../../modules/expo-bluesky-context-menu' +export { + Menu, + MenuItem, + MenuItemIcon, + MenuItemText, + Root, + Trigger, +} from '../../../modules/expo-bluesky-context-menu' diff --git a/src/components/PeekMenu/index.tsx b/src/components/PeekMenu/index.tsx new file mode 100644 index 0000000000..695347edc2 --- /dev/null +++ b/src/components/PeekMenu/index.tsx @@ -0,0 +1,54 @@ +import {type ReactNode} from 'react' +import {type StyleProp, View, type ViewStyle} from 'react-native' + +import {type IconWithSvgMeta} from '#/components/icons/TEMPLATE' +import {type PreviewContent} from '../../../modules/expo-bluesky-context-menu' + +export type { + MenuItemSpec, + PreviewContent, +} from '../../../modules/expo-bluesky-context-menu' + +export function Root({ + children, + style, +}: { + children: ReactNode + style?: StyleProp +}) { + return {children} +} + +export function Trigger({ + children, +}: { + preview?: PreviewContent + onPreviewPress?: () => void + borderRadius?: number + style?: StyleProp + children: ReactNode +}) { + return <>{children} +} + +export function Menu(_: {children: ReactNode}): null { + return null +} + +export function MenuItem(_: { + id: string + destructive?: boolean + disabled?: boolean + onSelect: () => void + children: ReactNode +}): null { + return null +} + +export function MenuItemIcon(_: {icon: IconWithSvgMeta}): null { + return null +} + +export function MenuItemText(_: {children: string}): null { + return null +} diff --git a/src/components/Post/Embed/ImageContextMenu.tsx b/src/components/Post/Embed/ImageContextMenu.tsx index d70c3f7899..3aadb56901 100644 --- a/src/components/Post/Embed/ImageContextMenu.tsx +++ b/src/components/Post/Embed/ImageContextMenu.tsx @@ -1,14 +1,13 @@ import {type ReactNode} from 'react' import {type StyleProp, type ViewStyle} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {shareImageModal} from '#/lib/media/manip' import {useSaveImageToMediaLibrary} from '#/lib/media/save-image' import {ArrowShareRight_Stroke2_Corner2_Rounded as ShareIcon} from '#/components/icons/ArrowShareRight' import {Download_Stroke2_Corner0_Rounded as DownloadIcon} from '#/components/icons/Download' +import * as PeekMenu from '#/components/PeekMenu' import {IS_IOS} from '#/env' -import * as ContextMenu from '../../../../modules/expo-bluesky-context-menu' /** * Wraps an image embed with the iOS peek-and-menu interaction. On non-iOS @@ -38,7 +37,7 @@ export function ImageContextMenu({ style?: StyleProp children: ReactNode }) { - const {_} = useLingui() + const {t: l} = useLingui() const saveImage = useSaveImageToMediaLibrary() if (!IS_IOS) { @@ -53,8 +52,8 @@ export function ImageContextMenu({ } return ( - - + {children} - - - - - - {_(msg`Save image`)} - - - - - {_(msg`Share`)} - - - + + + + + {l`Save image`} + + + + {l`Share`} + + + ) }