mattermost-mobile-upstream/app/components/post_list/android_thread_scroll.ts
Nick Misasi 120f8980af
fix(MM-69538): restore Android thread scroll to root post header
Android inverted thread lists could not scroll far enough to reveal the
root post header after browsing replies. Apply Android-thread-specific
list padding and layout handling, include the root post in the initial
batch, and centralize detection in android_thread_scroll helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 17:14:14 -04:00

37 lines
864 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Platform} from 'react-native';
import {Screens} from '@constants';
import type {AvailableScreens} from '@typings/screens/navigation';
export const isAndroidThreadScreen = (location: AvailableScreens) => (
Platform.OS === 'android' && location === Screens.THREAD
);
type AndroidThreadRootPostArgs = {
location: AvailableScreens;
postId?: string;
rootId?: string;
isReplyPost?: boolean;
};
export const isAndroidThreadRootPost = ({
location,
postId,
rootId,
isReplyPost,
}: AndroidThreadRootPostArgs) => {
if (!isAndroidThreadScreen(location)) {
return false;
}
if (postId !== undefined && rootId !== undefined) {
return postId === rootId;
}
return !isReplyPost;
};