From 3268f4db5b43c88eb9f14fb219ec959e34410063 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 8 Mar 2018 09:26:33 -0800 Subject: [PATCH] fixed xxx/index and event binding --- react/components/ExpandingTextArea/index.jsx | 27 ++++++++++---------- react/containers/AssetDisplay/view.jsx | 2 +- react/containers/ShowAssetDetails/view.jsx | 12 ++++----- react/containers/ShowAssetLite/view.jsx | 4 +-- react/containers/ShowChannel/view.jsx | 8 +++--- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/react/components/ExpandingTextArea/index.jsx b/react/components/ExpandingTextArea/index.jsx index 182af876..db83c5d8 100644 --- a/react/components/ExpandingTextArea/index.jsx +++ b/react/components/ExpandingTextArea/index.jsx @@ -2,31 +2,32 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; class ExpandingTextarea extends Component { + constructor (props) { + super(props); + this._handleChange = this._handleChange.bind(this); + } componentDidMount () { this.adjustTextarea({}); } - + _handleChange (event) { + const { onChange } = this.props; + if (onChange) onChange(event); + this.adjustTextarea(event); + } + adjustTextarea ({ target = this.el }) { + target.style.height = 0; + target.style.height = `${target.scrollHeight}px`; + } render () { const { ...rest } = this.props; return (