Created
July 11, 2019 05:22
-
-
Save anchetaWern/1f8649e6c23b353fe4edcdad16103152 to your computer and use it in GitHub Desktop.
Pokedex Bot: showResponse in App.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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