Skip to content

Commit

Permalink
[RNMobile] Merge mobile release v1.20.0 back into master (step 2) (#1…
Browse files Browse the repository at this point in the history
…9569)

* [RNMobile] Merge mobile release v1.20.0 back into master (#19562)

* styling fixes after navigation feature merge (#19455)

* Styling fixes to navigation feature

* Add netural styles for toolbar

* Fix condition for not registered component

* Display 'Unsupported' in breadcrumbs for missing components

* Refactor after CR

* Remove leftovers

* [FIX] rich text focus loop (#19240)

* check if onBlur event contains text that is different than value

* add check if there is a text in native event

* Prevent re-selection of RichText when native selection changes as a result of resigning focus

* Fix typo

* Check if isSelected only in onSelectionChangeFromAztec

Co-authored-by: Jorge Bernal <jbernal@gmail.com>

* [RNMobile] Correct displaying photo during upload (#19502)

* [RNMobile] Fix crash once adding Group (#19457)

* Add extra branch for travis to run tests onto

Co-authored-by: Luke Walczak <lukasz.walczak.pwr@gmail.com>
Co-authored-by: Drapich Piotr <drapich.piotr@gmail.com>
Co-authored-by: Jorge Bernal <jbernal@gmail.com>

* Revert travis changes

Co-authored-by: Luke Walczak <lukasz.walczak.pwr@gmail.com>
Co-authored-by: Drapich Piotr <drapich.piotr@gmail.com>
Co-authored-by: Jorge Bernal <jbernal@gmail.com>
  • Loading branch information
4 people authored Jan 14, 2020
1 parent 218b07f commit adaae10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/block-library/src/media-text/style.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

.contentCentered {
flex: 1;
justify-content: center;
align-items: center;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/button/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export function Button( props ) {
)
);

const newIcon = cloneElement( ( icon && <Icon icon={ icon } size={ iconSize } /> ),
{ colorScheme: props.preferredColorScheme, isPressed } );
const newIcon = icon ? cloneElement( ( <Icon icon={ icon } size={ iconSize } /> ),
{ colorScheme: props.preferredColorScheme, isPressed } ) : null;

const element = (
<TouchableOpacity
Expand Down
17 changes: 15 additions & 2 deletions packages/rich-text/src/component/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ export class RichText extends Component {
onBlur( event ) {
this.isTouched = false;

// Check if value is up to date with latest state of native AztecView
if ( event.nativeEvent.text && event.nativeEvent.text !== this.props.value ) {
this.onTextUpdate( event );
}

if ( this.props.onBlur ) {
this.props.onBlur( event );
}
Expand Down Expand Up @@ -457,8 +462,16 @@ export class RichText extends Component {
// Make sure there are changes made to the content before upgrading it upward
this.onTextUpdate( event );

this.onSelectionChange( realStart, realEnd );

// Aztec can send us selection change events after it has lost focus.
// For instance the autocorrect feature will complete a partially written
// word when resigning focus, causing a selection change event.
// Forwarding this selection change could cause this RichText to regain
// focus and start a focus loop.
//
// See https://github.com/wordpress-mobile/gutenberg-mobile/issues/1696
if ( this.props.__unstableIsSelected ) {
this.onSelectionChange( realStart, realEnd );
}
// Update lastEventCount to prevent Aztec from re-rendering the content it just sent
this.lastEventCount = event.nativeEvent.eventCount;

Expand Down

0 comments on commit adaae10

Please sign in to comment.