Skip to content

Commit

Permalink
can't reach the end!
Browse files Browse the repository at this point in the history
  • Loading branch information
gkasdorf committed Jun 13, 2023
1 parent 440c3c3 commit fec3380
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ios": {
"bundleIdentifier": "com.gkasdorf.memmyapp",
"supportsTablet": false,
"buildNumber": "1"
"buildNumber": "3"
},
"plugins": [
[
Expand Down
8 changes: 7 additions & 1 deletion app/tabs/feeds/[communityId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ const FeedsCommunityScreen = () => {
auth: lemmyAuthToken,
community_id: Number(communityId),
limit: 50,
page: !posts ? 1 : (posts.length / 50) + 1,
sort: sort
});

setPosts(res.posts);
if(!posts) {
setPosts(res.posts);
} else {
setPosts([...posts, ...res.posts]);
}

setLoading(false);
} catch(e) {
setLoading(false);
Expand Down
8 changes: 7 additions & 1 deletion app/tabs/feeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ const FeedsIndexScreen = () => {
const res = await lemmyInstance.getPosts({
auth: lemmyAuthToken,
limit: 50,
page: !posts ? 1 : (posts.length / 50) + 1,
sort: sort
});

setPosts(res.posts);
if(!posts) {
setPosts(res.posts);
} else {
setPosts([...posts, ...res.posts]);
}

setLoading(false);
} catch(e) {
setPosts(null);
Expand Down
3 changes: 3 additions & 0 deletions ui/Feed/FeedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ const FeedView = ({posts, load, loading, setSort, sort, titleDropsdown = true, c
keyExtractor={keyExtractor}
refreshControl={<RefreshControl refreshing={loading} onRefresh={load}/>}
estimatedItemSize={200}
onEndReached={load}
onEndReachedThreshold={0.95}
ListFooterComponent={loading ? <LoadingView /> : null}
/>
</View>
);
Expand Down

0 comments on commit fec3380

Please sign in to comment.