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

Mobile Native - Fix toolbar status when pressing buttons on Android (and iOS) #9319

Merged
merged 2 commits into from Aug 24, 2018

Conversation

Projects
None yet
3 participants
@daniloercoli
Contributor

daniloercoli commented Aug 24, 2018

Description

This PR fixes a problem where the status of the buttons in the toolbar could not be in synch with AztecRN editor. This is due to a problem in shouldComponentUpdate that skipped the update of RichText component after a button was pressed in the toolbar, since we're not checking the component state there, but only props (formatting options are stored in state), and then it returned false.

Instead of adding props to shouldComponentUpdate, I've decided to call forceUpdate (see onContentSizeChange where it is also used), that forces the component to call render and skips shouldComponentUpdate.

This PR also fixes another "huge" problem where the Native side always reset the editor from the start when content is set to it. This was due to missing eventCount passed to AztecRN.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

SergioEstevao and others added some commits Aug 24, 2018

- Force update the RichText component when a toolbar button is pressed
- Fix an issue where eventCount was not correctly propogated to AztecText resulting in a re-rendering of the component from scratch
@SergioEstevao

Great work!

@daniloercoli daniloercoli merged commit 20165c2 into master Aug 24, 2018

2 checks passed

codecov/project 50.58% (-0.01%) compared to 5632f68
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@daniloercoli daniloercoli deleted the rnmobile/fix-toolbar-status branch Aug 24, 2018

@Soean Soean added this to the 3.7 milestone Aug 24, 2018

ZebulanStanphill added a commit to ZebulanStanphill/gutenberg that referenced this pull request Aug 25, 2018

Mobile Native - Fix toolbar status when pressing buttons on Android (…
…and iOS) (#9319)

* Update use of content size change event.

* - Force update the RichText component when a toolbar button is pressed
- Fix an issue where eventCount was not correctly propogated to AztecText resulting in a re-rendering of the component from scratch

ZebulanStanphill added a commit to ZebulanStanphill/gutenberg that referenced this pull request Aug 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment