From 17473893aeab9d8d79a2500084083f23b934268c Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Tue, 27 Nov 2018 13:01:33 +0100 Subject: [PATCH] Make sure the component rerenders when isSelected changes so FormatToolbar is removed --- packages/editor/src/components/rich-text/index.native.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/rich-text/index.native.js b/packages/editor/src/components/rich-text/index.native.js index af057f1ba9636..7147a4c12fb75 100644 --- a/packages/editor/src/components/rich-text/index.native.js +++ b/packages/editor/src/components/rich-text/index.native.js @@ -227,18 +227,13 @@ export class RichText extends Component { return value; } - shouldComponentUpdate( nextProps, nextState ) { - if ( nextProps.tagName !== this.props.tagName ) { + shouldComponentUpdate( nextProps ) { + if ( nextProps.tagName !== this.props.tagName || nextProps.isSelected !== this.props.isSelected ) { this.lastEventCount = undefined; this.lastContent = undefined; return true; } - // Update if selection changed - if ( nextState.start !== this.state.start || nextState.end !== this.state.end ) { - return true; - } - // The check below allows us to avoid updating the content right after an `onChange` call. // The first time the component is drawn `lastContent` and `lastEventCount ` are both undefined if ( this.lastEventCount &&