From 3a70752ab5763513adc1d971effdcdb9d0b69fc4 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Jun 2019 17:15:18 +0200 Subject: [PATCH] [Glitch] Fix some React warnings Port 5c1a46bdcf83f156f558d7e771bc3da1eb90a646 to glitch-soc Signed-off-by: Thibaut Girka --- .../glitch/components/autosuggest_textarea.js | 5 +++-- .../features/compose/components/compose_form.js | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.js b/app/javascript/flavours/glitch/components/autosuggest_textarea.js index 7a6b9d8ac0..bbe0ffcbe0 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_textarea.js +++ b/app/javascript/flavours/glitch/components/autosuggest_textarea.js @@ -201,7 +201,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } return [ -
+
{children}
, -
+ +
{suggestions.map(this.renderSuggestion)}
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index 52aa79b350..71fd891144 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -28,10 +28,6 @@ const messages = defineMessages({ export default @injectIntl class ComposeForm extends ImmutablePureComponent { - setRef = c => { - this.composeForm = c; - }; - static contextTypes = { router: PropTypes.object, }; @@ -145,6 +141,10 @@ class ComposeForm extends ImmutablePureComponent { } } + setRef = c => { + this.composeForm = c; + }; + // Inserts an emoji at the caret. handleEmoji = (data) => { const { textarea: { selectionStart } } = this; @@ -213,7 +213,9 @@ class ComposeForm extends ImmutablePureComponent { } handleFocus = () => { - this.composeForm.scrollIntoView(); + if (this.composeForm) { + this.composeForm.scrollIntoView(); + } } // This statement does several things: