react-native-activity-feed
react-native-activity-feed copied to clipboard
Set FlatFeed data
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?
Any update with this? @jaapbakker88
...
@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?
@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?