-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
Hey just a couple friendly reminders:
|
6d06bcd
to
9b93e9b
Compare
FYI, still working on some issue fixes (pushed some WIP commits to 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Pressing on the buttons didn't change the format of the selected text.
…/fix-crash-on-merge-2
@@ -343,6 +391,8 @@ export class RichText extends Component { | |||
if ( onRemove && empty && isReverse ) { | |||
onRemove( ! isReverse ); | |||
} | |||
|
|||
event.preventDefault(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…es won't change the format of the selected text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🎉
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