From d7a75a206281b99ad38fea576aa20a0557fd3d65 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Tue, 11 Oct 2022 09:37:01 -0500
Subject: Home button scrolls to top when on home page

---
 src/view/com/posts/Feed.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/view/com/posts/Feed.tsx')

diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx
index 028480eb4..dc341ddd5 100644
--- a/src/view/com/posts/Feed.tsx
+++ b/src/view/com/posts/Feed.tsx
@@ -1,4 +1,4 @@
-import React from 'react'
+import React, {MutableRefObject} from 'react'
 import {observer} from 'mobx-react-lite'
 import {Text, View, FlatList, StyleProp, ViewStyle} from 'react-native'
 import {FeedModel, FeedItemModel} from '../../../state/models/feed-view'
@@ -7,9 +7,11 @@ import {FeedItem} from './FeedItem'
 export const Feed = observer(function Feed({
   feed,
   style,
+  scrollElRef,
 }: {
   feed: FeedModel
   style?: StyleProp<ViewStyle>
+  scrollElRef?: MutableRefObject<FlatList<any> | null>
 }) {
   // TODO optimize renderItem or FeedItem, we're getting this notice from RN: -prf
   //   VirtualizedList: You have a large list that is slow to update - make sure your
@@ -30,6 +32,7 @@ export const Feed = observer(function Feed({
       {feed.hasError && <Text>{feed.error}</Text>}
       {feed.hasContent && (
         <FlatList
+          ref={scrollElRef}
           data={feed.feed.slice()}
           keyExtractor={item => item._reactKey}
           renderItem={renderItem}
-- 
cgit 1.4.1

