GetStream / react-native-activity-feed

Official React Native SDK for Activity Feeds
https://getstream.io/
200 stars 87 forks source link

Set FlatFeed data #144

Open luisfuertes opened 4 years ago

luisfuertes commented 4 years ago

Ok i have tried this to get other user likes activities:

  _initList = async () => {
    const { client, username } = this.props

    const options = {
      kind: 'like',
      limit: 20,
      user_id: username,
      withOwnReactions: true,
      withReactionCounts: true,
    }

    const res = await client.reactions.filter(options)
    const results = _.get(res, 'results', [])
    console.log('results: ', results)
    if (!_.size(results)) {
      return
    }

    const activitiesIds = _.map(results, v => _.get(v, 'activity_id'))
    const activities = await client.getActivities({ ...options, ids: activitiesIds })
    console.log('activities: ', activities)
    this.setState({ flatListData: activities.results })
  }

And in FlatFeed

      <FlatFeed
        setListRef={ref =>  this.props.setFeedRef(ref)}
        feedGroup="timeline"
        flatListProps={{
          ...FLAT_FEED_LIST_PROPS,
          style: styles.feed,
          contentContainerStyle: styles.contentContainer,
          onViewableItemsChanged: this._onViewableItemsChanged,
          data: this.state.flatListData
        }}
        {...rest}
     />

But have next error: TypeError: item.get is not a function I dont want use my own FlatList because i lost functions like "onToggleReation" in my activities.

Any idea?

luisfuertes commented 4 years ago

Any update with this? @jaapbakker88

luisfuertes commented 4 years ago

...

jaapbakker88 commented 4 years ago

@luisfuertes I'm not 100% sure what you're trying to do. Have you tried putting the liked feeds in a seperate feedgroup something like user_liked_activities as we suggested in a different issue?

luisfuertes commented 4 years ago

@jaapbakker88 i asked you in the other issue #140 if the reactions such as comments would not appear separated in one and another activity when doing that?