Skip to content

Commit

Permalink
Limit getHtmlForRecordCreation calls to Android
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed May 26, 2020
1 parent c7cb54a commit eace29c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions packages/rich-text/src/component/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ export class RichText extends Component {
const { selectionStart: start, selectionEnd: end } = this.props;
const { value } = this.props;

const html = this.getHtmlForRecordCreation( value, this.multilineTag );

const { formats, replacements, text } = this.formatToValue( html );
const { formats, replacements, text } = this.formatToValue( value );
const { activeFormats } = this.state;

return { formats, replacements, text, start, end, activeFormats };
Expand All @@ -145,10 +143,14 @@ export class RichText extends Component {
*/
createRecord() {
const { preserveWhiteSpace } = this.props;
const htmlForCreate = this.getHtmlForRecordCreation(
this.value,
this.multilineTag
);
let htmlForCreate = this.value;
if ( ! this.isIOS ) {
htmlForCreate = this.getHtmlForRecordCreation(
this.value,
this.multilineTag
);
}

const value = {
start: this.selectionStart,
end: this.selectionEnd,
Expand Down Expand Up @@ -549,8 +551,15 @@ export class RichText extends Component {
}

if ( this.props.format === 'string' ) {
let htmlForCreate = value;
if ( ! this.isIOS ) {
htmlForCreate = this.getHtmlForRecordCreation(
value,
this.multilineTag
);
}
return create( {
html: value,
html: htmlForCreate,
multilineTag: this.multilineTag,
multilineWrapperTags: this.multilineWrapperTags,
preserveWhiteSpace,
Expand Down

0 comments on commit eace29c

Please sign in to comment.