react-web-gifted-chat icon indicating copy to clipboard operation
react-web-gifted-chat copied to clipboard

How to configure gift-chat to send message when enter key is pressed?

Open iswetak opened this issue 5 years ago • 1 comments

Issue Description

[FILL THIS OUT]

Steps to Reproduce / Code Snippets

[FILL THIS OUT]

Expected Results

[FILL THIS OUT]

Additional Information

  • Nodejs version: [FILL THIS OUT]
  • React version: [FILL THIS OUT]
  • react-web-gifted-chat version: [FILL THIS OUT]
  • Browser(s) (Chrome, etc.): [FILL THIS OUT]

iswetak avatar Apr 28 '20 09:04 iswetak

its already available 'onSend'

constructor(props) {
  //init stuff
  this.onSend = this.onSend.bind(this); //bind the function
}

onSend(message) {
  if(message && message[0] && message[0].text){
     //send msg to server
  }
}

render() { 
  return ( 
  <GiftedChat
    ..other props.. 
    onSend={this.onSend}/>
  );
}

9paradox avatar May 09 '20 05:05 9paradox