Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doFeedRequest with offset #240

Open
voortexx opened this issue Dec 8, 2021 · 0 comments
Open

doFeedRequest with offset #240

voortexx opened this issue Dec 8, 2021 · 0 comments

Comments

@voortexx
Copy link

voortexx commented Dec 8, 2021

Setup

  • iOS or Android? Both
  • Expo or regular React Native? Regular
  • React Native Version: 0.64.2
  • react-native-activity-feed: 0.8.22
  • getstream: 4.5.4

Describe the bug
Currently we use the FlatFeed with the ListEmptyComponent props to display a fallback image when we have no messages.

We would like to be able to distinguish the loading state with no data (to display a placeholder) from the state where we have no data (to display another image).

From what I've seen we don't have access to any isLoading props to know if the first get is finished.

So I tried simply like this

  const doFeedRequest = async () => {
    const response = await feed.get({ withReactionCounts: true, offset })
    const newOffset = offset + response.results.length
    setOffset(newOffset)
    return response
  }

This works except that when I scroll down my offset is reset and so the data loaded is always the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant