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

[RN Mobile] Fix crash when merging block #15392

Merged
merged 29 commits into from
May 15, 2019
Merged

Conversation

Tug
Copy link
Contributor

@Tug Tug commented May 2, 2019

This PR aims to upgrade RichText on mobile native to use the latest changes from the web, mainly those made in #14640

It also removes the customization we made to the rich-text library since writing in multiple formats at once is now stable on the web.

Testing Instructions

Tested with wordpress-mobile/gutenberg-mobile#949

@nerrad
Copy link
Contributor

nerrad commented May 2, 2019

Hey just a couple friendly reminders:

  • For WIP it's more project friendly to use the draft pull feature in github because automatic codeowner and any requested reviewers will not get notified until the pull is published. So you can still work on it without worrying about increasing the notification noise to potential reviewers.
  • I started looking at this before noticing it was a WIP, on the surface it looks like you're not basing this branch off of a clean master because there seems to be a number of unrelated changes in the diff. You're likely already aware but just thought I'd point out in case you weren't. I see the force-push fixed 👍

@Tug Tug force-pushed the rnmobile/fix-crash-on-merge-2 branch from 6d06bcd to 9b93e9b Compare May 2, 2019 12:54
@Tug Tug removed request for mkaz and karmatosed May 2, 2019 13:05
@hypest
Copy link
Contributor

hypest commented May 12, 2019

FYI, still working on some issue fixes (pushed some WIP commits to rnmobile/fix-crash-on-merge-2-extra-fixes).

Edit on May 13th 2019: Added couple more fixes, including an AztecAndroid change for avoiding some stray onSelectionChange events.

// ///
// } else {
// if ( doUpdateChild ) {
// this.lastEventCount = undefined;
Copy link
Contributor

@etoledom etoledom May 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hypest - This is the source of the format issue on iOS. If eventCount is other than undefined, the Aztec-iOS wrapper will not update its content, so we need to undefine it at some point, for the format change to work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what was the reason to do this change, but if it's working properly on Android, maybe we can modify the native iOS Aztec wrapper to work as the Android one does?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted over Slack and I think the culprit is to be found in the shouldComponentUpdate function? The assumption we can try to align to is that a "normal" prop change (initiated by https://github.com/WordPress/gutenberg/pull/15392/files/380660e7d751834ac0de4eb7f207d0c0f89fa863#diff-4828a21853e899e5a36faecfa96d83e8R272) should be enough to cause the code to try and force the changes to the Aztecs.

@@ -343,6 +391,8 @@ export class RichText extends Component {
if ( onRemove && empty && isReverse ) {
onRemove( ! isReverse );
}

event.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense on RN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really indeed.
I don't think it's doing anything at the moment (it probably could if we handled it on the native side?), I just added it because I wanted the code to get closer to the RichText web version so we can merge the two in the short term.
If you find it confusing I don't mind removing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok for me, it will actually be nice that this sent something back to the native side, and then we could decide how to handle the Enter/Delete after JS processed the event.

Copy link
Contributor

@hypest hypest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor Author

@Tug Tug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well!

@etoledom etoledom self-requested a review May 15, 2019 10:29
Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 🎉

@Tug Tug merged commit 761543e into master May 15, 2019
@Tug Tug deleted the rnmobile/fix-crash-on-merge-2 branch May 15, 2019 10:55
@Tug Tug added Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) and removed [Status] In Progress Tracking issues with work in progress labels May 15, 2019
@youknowriad youknowriad added this to the 5.8 (Gutenberg) milestone May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants