Hide the mobile reply control if outside the threadgate (#2177)

This commit is contained in:
Paul Frazee 2023-12-11 15:11:36 -08:00 committed by GitHub
parent 9a59525b73
commit 3592f6f50b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,4 @@
import React, {useRef} from 'react'
import React, {useEffect, useRef} from 'react'
import {
ActivityIndicator,
Pressable,
@ -64,9 +64,11 @@ type YieldedItem =
export function PostThread({
uri,
onCanReply,
onPressReply,
}: {
uri: string | undefined
onCanReply: (canReply: boolean) => void
onPressReply: () => void
}) {
const {
@ -86,6 +88,11 @@ export function PostThread({
rootPost.author.displayName || `@${rootPost.author.handle}`,
)}: "${rootPostRecord?.text}"`,
)
useEffect(() => {
if (rootPost) {
onCanReply(!rootPost.viewer?.replyDisabled)
}
}, [rootPost, onCanReply])
if (isError || AppBskyFeedDefs.isNotFoundPost(thread)) {
return (