From 28679bfba2d4160cd54fe368e5412aa622cd8c6e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Jun 2018 13:02:30 +0300 Subject: transform-class-properties --- vnext/src/components/MessageInput.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'vnext/src/components/MessageInput.js') diff --git a/vnext/src/components/MessageInput.js b/vnext/src/components/MessageInput.js index 6e698c32..e30962a8 100644 --- a/vnext/src/components/MessageInput.js +++ b/vnext/src/components/MessageInput.js @@ -9,12 +9,6 @@ import Button from './Button'; export default class MessageInput extends React.Component { constructor(props) { super(props) - this.textChanged = this.textChanged.bind(this); - this.attachmentChanged = this.attachmentChanged.bind(this); - this.openfile = this.openfile.bind(this); - this.handleCtrlEnter = this.handleCtrlEnter.bind(this); - this.onSubmit = this.onSubmit.bind(this); - this.textarea = React.createRef(); this.fileinput = React.createRef(); this.state = { @@ -26,13 +20,13 @@ export default class MessageInput extends React.Component { } } - handleCtrlEnter(event) { + handleCtrlEnter = (event) => { if (event.ctrlKey && (event.charCode == 10 || event.charCode == 13)) { this.onSubmit({}) } } - onSubmit(event) { + onSubmit = (event) => { if (event.preventDefault) event.preventDefault(); const input = this.fileinput.current; this.props.onSend({ @@ -50,7 +44,7 @@ export default class MessageInput extends React.Component { componentDidMount() { this.textarea.current.focus() } - textChanged(event) { + textChanged = (event) => { this.setState({ body: event.target.value }) @@ -59,12 +53,12 @@ export default class MessageInput extends React.Component { const height = el.scrollHeight + offset; el.style.height = `${height + offset}px`; } - attachmentChanged(event) { + attachmentChanged = (event) => { this.setState({ attach: event.target.value }) } - openfile() { + openfile = () => { const input = this.fileinput.current; if (this.state.attach) { this.setState({ -- cgit v1.2.3