Skip to content

doFeedRequest with offset #240

@voortexx

Description

@voortexx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions