Skip to content

Instantly share code, notes, and snippets.

@anchetaWern
Created July 11, 2019 05:22
Show Gist options
  • Select an option

  • Save anchetaWern/1f8649e6c23b353fe4edcdad16103152 to your computer and use it in GitHub Desktop.

Select an option

Save anchetaWern/1f8649e6c23b353fe4edcdad16103152 to your computer and use it in GitHub Desktop.
Pokedex Bot: showResponse in App.js
showResponse(text, payload) {
let msg = {
_id: this.state.messages.length + 1,
text,
createdAt: new Date(),
user: BOT_USER
};
if (payload && payload.is_image) {
msg.text = text;
msg.image = payload.url;
}
this.setState(previousState => ({
messages: GiftedChat.append(previousState.messages, [msg])
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment