Newbie to Meteor/React Native and have been enjoying the super fast development so far, but seem to have run into my first speed bump. More like I’m stuck in a ditch and could really use some help. @spencercarli @copleykj
class Inbox extends Component {
constructor(props) {
super();
}
renderRow(message) {
return (
<Text>{message.body}</Text>
);
}
render() {
return (
<MeteorListView
collection="messages"
renderRow={this.renderRow}
/>
);
}
}
export default createContainer(params => {
Meteor.subscribe('messages');
return {};
}, Inbox);
Now, I’m assuming I need to make a publication that returns the messages of the conversations that the currently logged in user is participating in?
https://atmospherejs.com/socialize/messaging
export default () => {
Meteor.publish('messages', function () {
var conversations = Meteor.conversations.find({_participants: this.userId});//better way to get conversations for the current user?
// now i don't know what to do!!
conversations.forEach(function(c) {
c.messages(/*optional params*/).forEach(function(message){
console.log(message.user().username, ": ", message.body);
});
});
// the above seems to get me the information I need
// but I don't know how to do it through a cursor so I can publish it to the client.
// need an ELI5 example
});
}
I appreciate it. Thank you so much for your time.