From afb65f470af80c021d750e04723e551157cfce4e Mon Sep 17 00:00:00 2001 From: Sergio Estevao Date: Wed, 2 Oct 2019 12:47:06 +0100 Subject: [PATCH 1/3] Make sure that HTML that is sent is correctly updated. --- packages/rich-text/src/component/index.native.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index 206680d3c8766..a7698083432c1 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -753,13 +753,15 @@ export class RichText extends Component { getHtmlToRender( record, tagName ) { // Save back to HTML from React tree - const value = this.valueToFormat( record ); + let value = this.valueToFormat( record ); - if ( value === undefined || value === '' ) { + if ( value === undefined ) { this.lastEventCount = undefined; // force a refresh on the native side - return ''; - } else if ( tagName ) { - return `<${ tagName }>${ value }`; + value = ''; + } + + if ( tagName ) { + value = `<${ tagName }>${ value }`; } return value; } From 978b45428944dea57142fe22204afd9dc2c8a4e6 Mon Sep 17 00:00:00 2001 From: Sergio Estevao Date: Wed, 2 Oct 2019 13:53:27 +0100 Subject: [PATCH 2/3] Fix issue in Android. --- packages/rich-text/src/component/index.native.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index a7698083432c1..36d580f36b41f 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -758,8 +758,12 @@ export class RichText extends Component { if ( value === undefined ) { this.lastEventCount = undefined; // force a refresh on the native side value = ''; - } - + } + // On android if content is empty we need to send no content or else the placeholder with not show + if ( ! this.iOS && value === '') { + return value; + } + if ( tagName ) { value = `<${ tagName }>${ value }`; } From dc75f93d4849db782353dce874e32e05b014db2c Mon Sep 17 00:00:00 2001 From: Sergio Estevao Date: Wed, 2 Oct 2019 13:58:58 +0100 Subject: [PATCH 3/3] Fix lint issues. --- packages/rich-text/src/component/index.native.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index 36d580f36b41f..7dd7be39d15df 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -440,7 +440,7 @@ export class RichText extends Component { /** * Handles a paste event from the native Aztec Wrapper. * - * @param {PasteEvent} event The paste event which wraps `nativeEvent`. + * @param {Object} event The paste event which wraps `nativeEvent`. */ onPaste( event ) { const { @@ -759,8 +759,8 @@ export class RichText extends Component { this.lastEventCount = undefined; // force a refresh on the native side value = ''; } - // On android if content is empty we need to send no content or else the placeholder with not show - if ( ! this.iOS && value === '') { + // On android if content is empty we need to send no content or else the placeholder with not show. + if ( ! this.iOS && value === '' ) { return value; }