From 237e957d1699fb4da756e9acc98c527f282e90b0 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 7 Jul 2023 12:00:17 -0500 Subject: Fixes and improvements to the Profile Preview modal (#992) * Fix: use more reliable navigation method * Fix: show lightbox over the active modal * Fix: close the profile preview on navigation * Factor out UserPreviewLink and add preview behavior to notifications * Fix postmeta overflow on web * Fix lint --- src/view/com/util/UserPreviewLink.tsx | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/view/com/util/UserPreviewLink.tsx (limited to 'src/view/com/util/UserPreviewLink.tsx') diff --git a/src/view/com/util/UserPreviewLink.tsx b/src/view/com/util/UserPreviewLink.tsx new file mode 100644 index 000000000..ae49301fd --- /dev/null +++ b/src/view/com/util/UserPreviewLink.tsx @@ -0,0 +1,43 @@ +import React from 'react' +import {Pressable, StyleProp, ViewStyle} from 'react-native' +import {useStores} from 'state/index' +import {Link} from './Link' +import {isDesktopWeb} from 'platform/detection' + +interface UserPreviewLinkProps { + did: string + handle: string + style?: StyleProp +} +export function UserPreviewLink( + props: React.PropsWithChildren, +) { + const store = useStores() + + if (isDesktopWeb) { + return ( + + {props.children} + + ) + } + return ( + + store.shell.openModal({ + name: 'profile-preview', + did: props.did, + }) + } + accessibilityRole="button" + accessibilityLabel={props.handle} + accessibilityHint="" + style={props.style}> + {props.children} + + ) +} -- cgit 1.4.1