portal in buttons so they move with swipe
This commit is contained in:
@@ -42,11 +42,14 @@ import {Trash_Stroke2_Corner0_Rounded} from '#/components/icons/Trash'
|
|||||||
import {Link} from '#/components/Link'
|
import {Link} from '#/components/Link'
|
||||||
import {useMenuControl} from '#/components/Menu'
|
import {useMenuControl} from '#/components/Menu'
|
||||||
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
||||||
|
import {createPortalGroup} from '#/components/Portal'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {useSimpleVerificationState} from '#/components/verification'
|
import {useSimpleVerificationState} from '#/components/verification'
|
||||||
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
||||||
import type * as bsky from '#/types/bsky'
|
import type * as bsky from '#/types/bsky'
|
||||||
|
|
||||||
|
export const ChatListItemPortal = createPortalGroup()
|
||||||
|
|
||||||
export let ChatListItem = ({
|
export let ChatListItem = ({
|
||||||
convo,
|
convo,
|
||||||
showMenu = true,
|
showMenu = true,
|
||||||
@@ -331,6 +334,7 @@ function ChatListItemReady({
|
|||||||
const hasUnread = convo.unreadCount > 0 && !isDeletedAccount
|
const hasUnread = convo.unreadCount > 0 && !isDeletedAccount
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<ChatListItemPortal.Provider>
|
||||||
<GestureActionView actions={actions}>
|
<GestureActionView actions={actions}>
|
||||||
<View
|
<View
|
||||||
onMouseEnter={onMouseEnter}
|
onMouseEnter={onMouseEnter}
|
||||||
@@ -365,8 +369,14 @@ function ChatListItemReady({
|
|||||||
accessibilityActions={
|
accessibilityActions={
|
||||||
isNative
|
isNative
|
||||||
? [
|
? [
|
||||||
{name: 'magicTap', label: _(msg`Open conversation options`)},
|
{
|
||||||
{name: 'longpress', label: _(msg`Open conversation options`)},
|
name: 'magicTap',
|
||||||
|
label: _(msg`Open conversation options`),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'longpress',
|
||||||
|
label: _(msg`Open conversation options`),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -450,7 +460,11 @@ function ChatListItemReady({
|
|||||||
{!isDeletedAccount && (
|
{!isDeletedAccount && (
|
||||||
<Text
|
<Text
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
style={[a.text_sm, t.atoms.text_contrast_medium, a.pb_xs]}>
|
style={[
|
||||||
|
a.text_sm,
|
||||||
|
t.atoms.text_contrast_medium,
|
||||||
|
a.pb_xs,
|
||||||
|
]}>
|
||||||
@{profile.handle}
|
@{profile.handle}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@@ -497,6 +511,8 @@ function ChatListItemReady({
|
|||||||
)}
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
<ChatListItemPortal.Outlet />
|
||||||
|
|
||||||
{showMenu && (
|
{showMenu && (
|
||||||
<ConvoMenu
|
<ConvoMenu
|
||||||
convo={convo}
|
convo={convo}
|
||||||
@@ -513,7 +529,8 @@ function ChatListItemReady({
|
|||||||
a.justify_center,
|
a.justify_center,
|
||||||
{
|
{
|
||||||
right: tokens.space.lg,
|
right: tokens.space.lg,
|
||||||
opacity: !gtMobile || showActions || menuControl.isOpen ? 1 : 0,
|
opacity:
|
||||||
|
!gtMobile || showActions || menuControl.isOpen ? 1 : 0,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
latestReportableMessage={latestReportableMessage}
|
latestReportableMessage={latestReportableMessage}
|
||||||
@@ -526,5 +543,6 @@ function ChatListItemReady({
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</GestureActionView>
|
</GestureActionView>
|
||||||
|
</ChatListItemPortal.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {useSession} from '#/state/session'
|
|||||||
import {atoms as a, tokens} from '#/alf'
|
import {atoms as a, tokens} from '#/alf'
|
||||||
import {KnownFollowers} from '#/components/KnownFollowers'
|
import {KnownFollowers} from '#/components/KnownFollowers'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {ChatListItem} from './ChatListItem'
|
import {ChatListItem, ChatListItemPortal} from './ChatListItem'
|
||||||
import {AcceptChatButton, DeleteChatButton, RejectMenu} from './RequestButtons'
|
import {AcceptChatButton, DeleteChatButton, RejectMenu} from './RequestButtons'
|
||||||
|
|
||||||
export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
|
export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
|
||||||
@@ -42,7 +42,8 @@ export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
|
|||||||
<Trans comment="Accept a chat request">Accept Request</Trans>
|
<Trans comment="Accept a chat request">Accept Request</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</ChatListItem>
|
{/* then, this gets absolutely positioned on top of the spacer */}
|
||||||
|
<ChatListItemPortal.Portal>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.absolute,
|
a.absolute,
|
||||||
@@ -73,6 +74,8 @@ export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
</ChatListItemPortal.Portal>
|
||||||
|
</ChatListItem>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user