Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] Merge mobile release v1.20.0 back into master (step 2) #19569

Merged
merged 5 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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