Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import React from 'react';
import { StreamApp, NotificationDropdown, FlatFeed, LikeButton, Activity, CommentField, CommentList } from 'react-activity-feed';
import 'react-activity-feed/dist/index.css';
const customDoFeedRequest = (client, feedGroup, userId, options) => {
const feed = client.feed(feedGroup, userId);
const feedPromise = feed.get(options);
feedPromise.then((res) => {
console.log('doFeedRequest: Promise:', res.results);
res.results.forEach((activity) => {
if (activity) {
activity.object = 'Hacked: Replaced in a custom doFeedRequest';
}
});
return res;
})
console.log('doFeedRequest:', feedPromise);
return feedPromise;
}
class App extends React.Component {
render () {
return (
<StreamApp
apiKey="rssn9mmqe6tz"
appId="51547"
token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlci1vbmUifQ.Wc6O-J5o-nFGmnkzQ8cKCoALnAIvA8-xD-8X7weHHPQ"
>
<NotificationDropdown notify doFeedRequest={customDoFeedRequest} />
<FlatFeed
options={{reactions: { recent: true } }}
doFeedRequest={customDoFeedRequest}
notify
Activity={(props) => {
// props.activity.object = 'Hello foreign ID: ' + props.activity.foreign_id;
return <Activity {...props}
Footer={() => {
console.log(props);
return (
<div style={ {padding: '8px 16px'} }>
<LikeButton {...props} />
<CommentField
activity={props.activity}
onAddReaction={props.onAddReaction} />
<CommentList activityId={props.activity.id} />
</div>
)}}
/>
}}
/>
</StreamApp>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.