From 3592f6f50b98c6bc81ebbf50f11f85df23376e53 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 11 Dec 2023 15:11:36 -0800 Subject: Hide the mobile reply control if outside the threadgate (#2177) --- src/view/com/post-thread/PostThread.tsx | 9 ++++++++- src/view/screens/PostThread.tsx | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 633968c87..051bc7849 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -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 ( diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx index 4b1f51748..8e9e399f5 100644 --- a/src/view/screens/PostThread.tsx +++ b/src/view/screens/PostThread.tsx @@ -37,6 +37,7 @@ export function PostThreadScreen({route}: Props) { const {isMobile} = useWebMediaQueries() const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) const {data: resolvedUri, error: uriError} = useResolveUriQuery(uri) + const [canReply, setCanReply] = React.useState(false) useFocusEffect( React.useCallback(() => { @@ -84,10 +85,11 @@ export function PostThreadScreen({route}: Props) { )} - {isMobile && ( + {isMobile && canReply && (