From 6454ecef574421ca4f99bb1e7e0f9cf265027f8a Mon Sep 17 00:00:00 2001 From: Piotr Drapich Date: Fri, 29 May 2020 13:29:50 +0200 Subject: [PATCH 1/2] add default vale to format when start and end are undefined --- .../rich-text/src/component/index.native.js | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index 7012fd079546a2..b1f554caa0357f 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -178,7 +178,7 @@ export class RichText extends Component { } onFormatChange( record ) { - const { start, end, activeFormats = [] } = record; + const { start = 0, end = 0, activeFormats = [] } = record; const changeHandlers = pickBy( this.props, ( v, key ) => key.startsWith( 'format_on_change_functions_' ) ); @@ -837,34 +837,29 @@ export class RichText extends Component { onFocus={ () => {} } /> - { - // eslint-disable-next-line no-undef - __DEV__ && isMentionsSupported( capabilities ) && ( - - } - onClick={ () => { - addMention() - .then( - ( mentionUserId ) => { - let stringToInsert = `@${ mentionUserId }`; - if ( this.isIOS ) { - stringToInsert += - ' '; - } - this.insertString( - record, - stringToInsert - ); - } - ) - .catch( () => {} ); - } } - /> - - ) - } + { // eslint-disable-next-line no-undef + __DEV__ && isMentionsSupported( capabilities ) && ( + + } + onClick={ () => { + addMention() + .then( ( mentionUserId ) => { + let stringToInsert = `@${ mentionUserId }`; + if ( this.isIOS ) { + stringToInsert += ' '; + } + this.insertString( + record, + stringToInsert + ); + } ) + .catch( () => {} ); + } } + /> + + ) } ) } From 71e2cc01ddb88ba033ced3d08d50de55d3b2cb0a Mon Sep 17 00:00:00 2001 From: Dratwas Date: Fri, 29 May 2020 15:17:29 +0200 Subject: [PATCH 2/2] revert lint changes --- .../rich-text/src/component/index.native.js | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js index b1f554caa0357f..1b542fa19e4962 100644 --- a/packages/rich-text/src/component/index.native.js +++ b/packages/rich-text/src/component/index.native.js @@ -837,29 +837,34 @@ export class RichText extends Component { onFocus={ () => {} } /> - { // eslint-disable-next-line no-undef - __DEV__ && isMentionsSupported( capabilities ) && ( - - } - onClick={ () => { - addMention() - .then( ( mentionUserId ) => { - let stringToInsert = `@${ mentionUserId }`; - if ( this.isIOS ) { - stringToInsert += ' '; - } - this.insertString( - record, - stringToInsert - ); - } ) - .catch( () => {} ); - } } - /> - - ) } + { + // eslint-disable-next-line no-undef + __DEV__ && isMentionsSupported( capabilities ) && ( + + } + onClick={ () => { + addMention() + .then( + ( mentionUserId ) => { + let stringToInsert = `@${ mentionUserId }`; + if ( this.isIOS ) { + stringToInsert += + ' '; + } + this.insertString( + record, + stringToInsert + ); + } + ) + .catch( () => {} ); + } } + /> + + ) + } ) }