diff --git a/app/components/post_list/post/post.tsx b/app/components/post_list/post/post.tsx index 78f552c347..37c536bb83 100644 --- a/app/components/post_list/post/post.tsx +++ b/app/components/post_list/post/post.tsx @@ -128,31 +128,34 @@ const Post = ({ return false; }, [isConsecutivePost, post, previousPost, isFirstReply]); + const handlePostPress = () => { + if ([Screens.SAVED_POSTS, Screens.MENTIONS, Screens.SEARCH].includes(location)) { + showPermalink(serverUrl, '', post.id, intl); + return; + } + + const isValidSystemMessage = isAutoResponder || !isSystemPost; + if (post.deleteAt === 0 && isValidSystemMessage && !isPendingOrFailed) { + if ([Screens.CHANNEL, Screens.PERMALINK].includes(location)) { + const rootId = post.rootId || post.id; + fetchAndSwitchToThread(serverUrl, rootId); + } + } else if ((isEphemeral || post.deleteAt > 0)) { + removePost(serverUrl, post); + } + + setTimeout(() => { + pressDetected.current = false; + }, 300); + }; + const handlePress = preventDoubleTap(() => { pressDetected.current = true; if (post) { - if (location === Screens.THREAD) { - Keyboard.dismiss(); - } else if ([Screens.SAVED_POSTS, Screens.MENTIONS, Screens.SEARCH].includes(location)) { - showPermalink(serverUrl, '', post.id, intl); - return; - } + Keyboard.dismiss(); - const isValidSystemMessage = isAutoResponder || !isSystemPost; - if (post.deleteAt === 0 && isValidSystemMessage && !isPendingOrFailed) { - if ([Screens.CHANNEL, Screens.PERMALINK].includes(location)) { - const rootId = post.rootId || post.id; - fetchAndSwitchToThread(serverUrl, rootId); - } - } else if ((isEphemeral || post.deleteAt > 0)) { - removePost(serverUrl, post); - } - - const pressTimeout = setTimeout(() => { - pressDetected.current = false; - clearTimeout(pressTimeout); - }, 300); + setTimeout(handlePostPress, 300); } });