summaryrefslogtreecommitdiffstats
path: root/web/react/components/textbox.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-09-03 15:30:58 -0400
committerChristopher Speller <crspeller@gmail.com>2015-09-03 15:30:58 -0400
commit9424fa92ab2bf404c600020d6b2428023b92bcc5 (patch)
treef670cafccd95fb011e17e1a1c1fce8db9fc8faa1 /web/react/components/textbox.jsx
parent2a62b00d76f4de921fbebc321f0c0debd30d41d6 (diff)
parente4336bbc84d00b3665b5f55e0220a67af030e33d (diff)
downloadchat-9424fa92ab2bf404c600020d6b2428023b92bcc5.tar.gz
chat-9424fa92ab2bf404c600020d6b2428023b92bcc5.tar.bz2
chat-9424fa92ab2bf404c600020d6b2428023b92bcc5.zip
Merge pull request #585 from mattermost/plt-37
PLT-37 Fix poor typing performance on iOS devices.
Diffstat (limited to 'web/react/components/textbox.jsx')
-rw-r--r--web/react/components/textbox.jsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx
index 0408a262d..b4518fe80 100644
--- a/web/react/components/textbox.jsx
+++ b/web/react/components/textbox.jsx
@@ -121,7 +121,6 @@ export default class Textbox extends React.Component {
}
this.addedMention = false;
this.refs.commands.getSuggestedCommands(nextProps.messageText);
- this.resize();
}
updateMentionTab(mentionText) {
// using setTimeout so dispatch isn't called during an in progress dispatch
@@ -135,7 +134,6 @@ export default class Textbox extends React.Component {
}
handleChange() {
this.props.onUserInput(React.findDOMNode(this.refs.message).value);
- this.resize();
}
handleKeyPress(e) {
const text = React.findDOMNode(this.refs.message).value;
@@ -244,6 +242,8 @@ export default class Textbox extends React.Component {
const e = React.findDOMNode(this.refs.message);
const w = React.findDOMNode(this.refs.wrapper);
+ let prevHeight = $(e).height();
+
const lht = parseInt($(e).css('lineHeight'), 10);
const lines = e.scrollHeight / lht;
let mod = 15;
@@ -259,6 +259,10 @@ export default class Textbox extends React.Component {
$(e).css({height: 'auto', 'overflow-y': 'scroll'}).height(167);
$(w).css({height: 'auto'}).height(167);
}
+
+ if (prevHeight !== $(e).height()) {
+ this.props.onHeightChange();
+ }
}
handleFocus() {
const elm = React.findDOMNode(this.refs.message);
@@ -316,5 +320,6 @@ Textbox.propTypes = {
messageText: React.PropTypes.string.isRequired,
onUserInput: React.PropTypes.func.isRequired,
onKeyPress: React.PropTypes.func.isRequired,
+ onHeightChange: React.PropTypes.func.isRequired,
createMessage: React.PropTypes.string.isRequired
};