Created
October 11, 2017 10:51
-
-
Save ayberkanilatsiz/8e2d89f9a3ed0d8253778c68cf7f731c to your computer and use it in GitHub Desktop.
socket handlers
This file contains 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
onReceivedMessage(mes){ | |
const arrMes = [{...mes.messages}]; | |
this.setState((previousState) => ({ | |
messages: GiftedChat.append(previousState.messages, arrMes), | |
})); | |
} | |
onSend(messages){ | |
const mes = messages[0]; | |
const { username } = this.state; | |
mes['username'] = username; | |
this.socket.emit('messages',mes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment