mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-18 17:38:15 +00:00
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>
37 lines
864 B
TypeScript
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;
|
|
};
|