From 411c1581f6e78898132baeae650365f3432f2a30 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Tue, 5 Sep 2023 13:40:38 -0700
Subject: Fix thread positioning on load (#1385)

* Fix minIndex for consistent positioning on thread view

* Enable maintainVisibleContentPosition on android now that it's supported
---
 src/view/com/post-thread/PostThread.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/view/com/post-thread/PostThread.tsx')

diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index f7766dfb7..59dfbe945 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -22,7 +22,7 @@ import {ViewHeader} from '../util/ViewHeader'
 import {ErrorMessage} from '../util/error/ErrorMessage'
 import {Text} from '../util/text/Text'
 import {s} from 'lib/styles'
-import {isIOS, isDesktopWeb} from 'platform/detection'
+import {isNative, isDesktopWeb} from 'platform/detection'
 import {usePalette} from 'lib/hooks/usePalette'
 import {useSetTitle} from 'lib/hooks/useSetTitle'
 import {useNavigation} from '@react-navigation/native'
@@ -30,7 +30,7 @@ import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
 import {NavigationProp} from 'lib/routes/types'
 import {sanitizeDisplayName} from 'lib/strings/display-names'
 
-const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 0}
+const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 2}
 
 const TOP_COMPONENT = {
   _reactKey: '__top_component__',
@@ -311,7 +311,7 @@ export const PostThread = observer(function PostThread({
       data={posts}
       initialNumToRender={posts.length}
       maintainVisibleContentPosition={
-        isIOS && view.isFromCache
+        isNative && view.isFromCache
           ? MAINTAIN_VISIBLE_CONTENT_POSITION
           : undefined
       }
@@ -326,7 +326,7 @@ export const PostThread = observer(function PostThread({
         />
       }
       onContentSizeChange={
-        isIOS && view.isFromCache ? undefined : onContentSizeChange
+        isNative && view.isFromCache ? undefined : onContentSizeChange
       }
       onScrollToIndexFailed={onScrollToIndexFailed}
       style={s.hContentRegion}
-- 
cgit 1.4.1

