about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-09-05 13:40:38 -0700
committerGitHub <noreply@github.com>2023-09-05 13:40:38 -0700
commit411c1581f6e78898132baeae650365f3432f2a30 (patch)
treebdb22d12fec7b431b72c1718895a1a31d4a3d09b /src
parente3e91816d1604c222b5be486c290b075d3faa443 (diff)
downloadvoidsky-411c1581f6e78898132baeae650365f3432f2a30.tar.zst
Fix thread positioning on load (#1385)
* Fix minIndex for consistent positioning on thread view

* Enable maintainVisibleContentPosition on android now that it's supported
Diffstat (limited to 'src')
-rw-r--r--src/view/com/post-thread/PostThread.tsx8
1 files changed, 4 insertions, 4 deletions
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}