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
This commit is contained in:
Paul Frazee 2023-07-07 12:00:17 -05:00 committed by GitHub
parent d8aded7b15
commit 237e957d16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 101 additions and 59 deletions

View file

@ -1,5 +1,5 @@
import React, {useMemo} from 'react'
import {Pressable, StyleSheet, View} from 'react-native'
import {StyleSheet, View} from 'react-native'
import Svg, {Circle, Rect, Path} from 'react-native-svg'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {IconProp} from '@fortawesome/fontawesome-svg-core'
@ -12,12 +12,11 @@ import {
import {useStores} from 'state/index'
import {colors} from 'lib/styles'
import {DropdownButton} from './forms/DropdownButton'
import {Link} from './Link'
import {usePalette} from 'lib/hooks/usePalette'
import {isWeb, isAndroid} from 'platform/detection'
import {Image as RNImage} from 'react-native-image-crop-picker'
import {AvatarModeration} from 'lib/labeling/types'
import {isDesktopWeb} from 'platform/detection'
import {UserPreviewLink} from './UserPreviewLink'
type Type = 'user' | 'algo' | 'list'
@ -257,28 +256,10 @@ export function UserAvatar({
}
export function PreviewableUserAvatar(props: PreviewableUserAvatarProps) {
const store = useStores()
if (isDesktopWeb) {
return (
<Link href={`/profile/${props.handle}`} title={props.handle} asAnchor>
<UserAvatar {...props} />
</Link>
)
}
return (
<Pressable
onPress={() =>
store.shell.openModal({
name: 'profile-preview',
did: props.did,
})
}
accessibilityRole="button"
accessibilityLabel={props.handle}
accessibilityHint="">
<UserPreviewLink did={props.did} handle={props.handle}>
<UserAvatar {...props} />
</Pressable>
</UserPreviewLink>
)
}