diff --git a/app/components/post_list/index.tsx b/app/components/post_list/index.tsx index 0b93dcf2db..a4fc270af6 100644 --- a/app/components/post_list/index.tsx +++ b/app/components/post_list/index.tsx @@ -3,17 +3,7 @@ import {FlatList} from '@stream-io/flat-list-mvcp'; import React, {ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react'; -import { - DeviceEventEmitter, - LayoutChangeEvent, - NativeScrollEvent, - NativeSyntheticEvent, - Platform, - StyleProp, - StyleSheet, - View, - ViewStyle, -} from 'react-native'; +import {DeviceEventEmitter, NativeScrollEvent, NativeSyntheticEvent, Platform, StyleProp, StyleSheet, ViewStyle} from 'react-native'; import Animated from 'react-native-reanimated'; import {fetchPosts, fetchPostThread} from '@actions/remote/post'; @@ -121,12 +111,6 @@ const PostList = ({ return orderedPosts.indexOf(START_OF_NEW_MESSAGES); }, [orderedPosts]); - const [offSetY, setOffSetY] = useState(0); - const onLayout = useCallback((layoutEvent: LayoutChangeEvent) => { - const {layout} = layoutEvent.nativeEvent; - setOffSetY(layout.y); - }, []); - useEffect(() => { listRef.current?.scrollToOffset({offset: 0, animated: false}); }, [channelId]); @@ -312,7 +296,6 @@ const PostList = ({ previousPost, shouldRenderReplyButton, skipSaveddHeader, - offSetY, }; return ( @@ -324,7 +307,7 @@ const PostList = ({ {...postProps} /> ); - }, [currentTimezone, highlightPinnedOrSaved, isTimezoneEnabled, orderedPosts, shouldRenderReplyButton, theme, offSetY]); + }, [currentTimezone, highlightPinnedOrSaved, isTimezoneEnabled, orderedPosts, shouldRenderReplyButton, theme]); const scrollToIndex = useCallback((index: number, animated = true, applyOffset = true) => { listRef.current?.scrollToIndex({ @@ -383,7 +366,6 @@ const PostList = ({ testID={`${testID}.flat_list`} /> - {showMoreMessages && ; testID?: string; - offSetY: number; }; const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { @@ -100,7 +99,7 @@ const Post = ({ appsEnabled, canDelete, currentUser, differentThreadSequence, filesCount, hasReplies, highlight, highlightPinnedOrSaved = true, highlightReplyBar, isConsecutivePost, isEphemeral, isFirstReply, isSaved, isJumboEmoji, isLastReply, isPostAddChannelMember, location, post, reactionsCount, shouldRenderReplyButton, skipSavedHeader, skipPinnedHeader, showAddReaction = true, style, - testID, previousPost, offSetY, + testID, previousPost, }: PostProps) => { const pressDetected = useRef(false); const intl = useIntl(); @@ -167,7 +166,7 @@ const Post = ({ } Keyboard.dismiss(); - const passProps = {location, post, showAddReaction, offSetY}; + const passProps = {location, post, showAddReaction}; const title = isTablet ? intl.formatMessage({id: 'post.options.title', defaultMessage: 'Options'}) : ''; if (isTablet) { diff --git a/app/screens/post_options/options/copy_permalink_option/copy_permalink_option.tsx b/app/screens/post_options/options/copy_permalink_option/copy_permalink_option.tsx index 9f58f31da9..0663ae34dd 100644 --- a/app/screens/post_options/options/copy_permalink_option/copy_permalink_option.tsx +++ b/app/screens/post_options/options/copy_permalink_option/copy_permalink_option.tsx @@ -19,16 +19,15 @@ type Props = { location: typeof Screens[keyof typeof Screens]; post: PostModel; teamName: string; - offSetY: number; } -const CopyPermalinkOption = ({teamName, post, location, offSetY}: Props) => { +const CopyPermalinkOption = ({teamName, post, location}: Props) => { const serverUrl = useServerUrl(); const handleCopyLink = useCallback(async () => { const permalink = `${serverUrl}/${teamName}/pl/${post.id}`; Clipboard.setString(permalink); await dismissBottomSheet(Screens.POST_OPTIONS); - showSnackBar({barType: SNACK_BAR_TYPE.LINK_COPIED, location, offSetY}); + showSnackBar({barType: SNACK_BAR_TYPE.LINK_COPIED, location}); }, [teamName, post.id]); return ( diff --git a/app/screens/post_options/options/copy_text_option.tsx b/app/screens/post_options/options/copy_text_option.tsx index a26e1088ec..02c178dcef 100644 --- a/app/screens/post_options/options/copy_text_option.tsx +++ b/app/screens/post_options/options/copy_text_option.tsx @@ -15,13 +15,12 @@ import BaseOption from './base_option'; type Props = { location: typeof Screens[keyof typeof Screens]; postMessage: string; - offSetY: number; } -const CopyTextOption = ({postMessage, location, offSetY}: Props) => { +const CopyTextOption = ({postMessage, location}: Props) => { const handleCopyText = useCallback(async () => { Clipboard.setString(postMessage); await dismissBottomSheet(Screens.POST_OPTIONS); - showSnackBar({barType: SNACK_BAR_TYPE.MESSAGE_COPIED, location, offSetY}); + showSnackBar({barType: SNACK_BAR_TYPE.MESSAGE_COPIED, location}); }, [postMessage]); return ( diff --git a/app/screens/post_options/post_options.tsx b/app/screens/post_options/post_options.tsx index 53aa8f65f0..d10f603e40 100644 --- a/app/screens/post_options/post_options.tsx +++ b/app/screens/post_options/post_options.tsx @@ -37,14 +37,13 @@ type PostOptionsProps = { post: PostModel; thread: Partial; componentId: string; - offSetY: number; }; const PostOptions = ({ canAddReaction, canDelete, canEdit, canMarkAsUnread, canPin, canReply, combinedPost, componentId, isSaved, - location, post, thread, offSetY, + location, post, thread, }: PostOptionsProps) => { const managedConfig = useManagedConfig(); @@ -98,7 +97,6 @@ const PostOptions = ({ } {!isSystemPost && } {canPin && void; location?: typeof Screens[keyof typeof Screens]; - offSetY?: number; }; export const showSnackBar = (passProps: ShowSnackBarArgs) => { const screen = Screens.SNACK_BAR;