From cc8f6b3cdaca81be99875c27002e0280d1d88191 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Jun 2019 17:15:18 +0200 Subject: [PATCH] Fix some React warnings (#10989) --- .../mastodon/components/autosuggest_textarea.js | 5 +++-- .../features/compose/components/compose_form.js | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 4c50294ba..b070fe3e5 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/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/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index 531b28866..558b7068b 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -33,10 +33,6 @@ const messages = defineMessages({ export default @injectIntl class ComposeForm extends ImmutablePureComponent { - setRef = c => { - this.composeForm = c; - }; - static contextTypes = { router: PropTypes.object, }; @@ -119,7 +115,9 @@ class ComposeForm extends ImmutablePureComponent { } handleFocus = () => { - this.composeForm.scrollIntoView(); + if (this.composeForm) { + this.composeForm.scrollIntoView(); + } } componentDidUpdate (prevProps) { @@ -163,6 +161,10 @@ class ComposeForm extends ImmutablePureComponent { this.spoilerText = c; } + setRef = c => { + this.composeForm = c; + }; + handleEmojiPick = (data) => { const { text } = this.props; const position = this.autosuggestTextarea.textarea.selectionStart;