From 605962f6089377c22610763394e8bdfb0895e25d Mon Sep 17 00:00:00 2001 From: Danilo Ercoli Date: Tue, 4 Dec 2018 14:00:57 +0100 Subject: [PATCH] Add a better comment explaining why onFocus is empty --- src/AztecView.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AztecView.js b/src/AztecView.js index 5809946..111ed30 100644 --- a/src/AztecView.js +++ b/src/AztecView.js @@ -139,7 +139,10 @@ class AztecView extends React.Component { onHTMLContentWithCursor = { this._onHTMLContentWithCursor } onSelectionChange = { this._onSelectionChange } onEnter = { this._onEnter } - onFocus = { () => {} } // Do nothing here, the onPress takes care of everything + // IMPORTANT: the onFocus events are thrown away as these are handled by onPress() in the upper level. + // It's necessary to do this otherwise onFocus may be set by `{...otherProps}` and thus the onPress + onFocus + // combination generate an infinite loop as described in https://github.com/wordpress-mobile/gutenberg-mobile/issues/302 + onFocus = { () => {} } onBlur = { this._onBlur } onBackspace = { this._onBackspace } />