react-native-activity-feed icon indicating copy to clipboard operation
react-native-activity-feed copied to clipboard

doFeedRequest with offset

Open voortexx opened this issue 3 years ago • 0 comments

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.

voortexx avatar Dec 08 '21 17:12 voortexx