Hide the mobile reply control if outside the threadgate (#2177)
parent
9a59525b73
commit
3592f6f50b
|
@ -1,4 +1,4 @@
|
||||||
import React, {useRef} from 'react'
|
import React, {useEffect, useRef} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Pressable,
|
Pressable,
|
||||||
|
@ -64,9 +64,11 @@ type YieldedItem =
|
||||||
|
|
||||||
export function PostThread({
|
export function PostThread({
|
||||||
uri,
|
uri,
|
||||||
|
onCanReply,
|
||||||
onPressReply,
|
onPressReply,
|
||||||
}: {
|
}: {
|
||||||
uri: string | undefined
|
uri: string | undefined
|
||||||
|
onCanReply: (canReply: boolean) => void
|
||||||
onPressReply: () => void
|
onPressReply: () => void
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
|
@ -86,6 +88,11 @@ export function PostThread({
|
||||||
rootPost.author.displayName || `@${rootPost.author.handle}`,
|
rootPost.author.displayName || `@${rootPost.author.handle}`,
|
||||||
)}: "${rootPostRecord?.text}"`,
|
)}: "${rootPostRecord?.text}"`,
|
||||||
)
|
)
|
||||||
|
useEffect(() => {
|
||||||
|
if (rootPost) {
|
||||||
|
onCanReply(!rootPost.viewer?.replyDisabled)
|
||||||
|
}
|
||||||
|
}, [rootPost, onCanReply])
|
||||||
|
|
||||||
if (isError || AppBskyFeedDefs.isNotFoundPost(thread)) {
|
if (isError || AppBskyFeedDefs.isNotFoundPost(thread)) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -37,6 +37,7 @@ export function PostThreadScreen({route}: Props) {
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey)
|
const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey)
|
||||||
const {data: resolvedUri, error: uriError} = useResolveUriQuery(uri)
|
const {data: resolvedUri, error: uriError} = useResolveUriQuery(uri)
|
||||||
|
const [canReply, setCanReply] = React.useState(false)
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
|
@ -84,10 +85,11 @@ export function PostThreadScreen({route}: Props) {
|
||||||
<PostThreadComponent
|
<PostThreadComponent
|
||||||
uri={resolvedUri?.uri}
|
uri={resolvedUri?.uri}
|
||||||
onPressReply={onPressReply}
|
onPressReply={onPressReply}
|
||||||
|
onCanReply={setCanReply}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
{isMobile && (
|
{isMobile && canReply && (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.prompt,
|
styles.prompt,
|
||||||
|
|
Loading…
Reference in New Issue