Last active
August 12, 2019 16:10
-
-
Save duytq94/9e522ee03d063dd317a8c4c94c69f9a5 to your computer and use it in GitHub Desktop.
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
onSendMessage = (content, type) => { | |
if (this.state.isShowSticker && type === 2) { | |
this.setState({ | |
isShowSticker: false | |
}) | |
} | |
if (content.trim() === '') { | |
return | |
} | |
const timestamp = moment() | |
.valueOf() | |
.toString() | |
const itemMessage = { | |
idFrom: this.currentUserId, | |
idTo: this.currentPeerUser.id, | |
timestamp: timestamp, | |
content: content.trim(), | |
type: type | |
} | |
myFirestore | |
.collection(AppString.NODE_MESSAGES) | |
.doc(this.groupChatId) | |
.collection(this.groupChatId) | |
.doc(timestamp) | |
.set(itemMessage) | |
.then(() => { | |
this.setState({ | |
inputValue: '' | |
}) | |
}) | |
.catch(err => { | |
this.props.showToast(0, err.toString()) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment