From 064262fea768d2fe52557b6aac44e16609bc5c39 Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Wed, 17 Feb 2021 13:40:54 +0100 Subject: [PATCH] Mobile - RichText - Restore onSelectionChange when its focused (#29074) --- packages/rich-text/src/component/index.native.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index 0f1041631f2606..6185f53b1bdf82 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -756,6 +756,12 @@ export class RichText extends Component { if ( isSelected && ! prevIsSelected ) { this._editor.focus(); + // Update selection props explicitly when component is selected as Aztec won't call onSelectionChange + // if its internal value hasn't change. When created, default value is 0, 0 + this.onSelectionChange( + this.props.selectionStart || 0, + this.props.selectionEnd || 0 + ); } else if ( ! isSelected && prevIsSelected ) { this._editor.blur(); }