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] Fix crash when editing a component that uses RangeControl #27987

Merged
merged 10 commits into from
Jan 5, 2021
Merged

[RNMobile] Fix crash when editing a component that uses RangeControl #27987

merged 10 commits into from
Jan 5, 2021

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Jan 5, 2021

Fixes #28081

Description

The crash was caused because RangeCell (the native component used in RangeControl) was calling the onComplete prop but not all the components that use it pass this handler. Since not all the components require this handler I changed it to be optional.

Looks like the bug was introduced in the Full width columns PR, I checked that some components were updated but only the ones that use the UnitControl component which is the other one that uses RangeCell underneath.

How has this been tested?

  1. Add a spacer block
  2. Tap settings gear
  3. Change spacing via text input

This can also be tested with other components that have a slider and an input box for editing block's settings, like:

  • Buttons block (Border radius setting)
  • Columns block (Column width setting)

Screenshots

iPhone 8 simulator
edit-spacer-block-ios.mp4
Pixel 4 emulator
edit-spacer-block-android.mp4

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

Update `master` branch from original repo.
Update master branch from original repo
Update master branch from original repo.
Update master branch from original repo
Update master branch from original repo.
Update master branch from original repo
Update master branch from original repo
Update master branch from original repo
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 5, 2021
@geriux geriux added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Jan 5, 2021
@geriux geriux requested review from geriux and ceyhun January 5, 2021 10:22
Comment on lines +74 to +76
if ( onComplete ) {
onComplete( nextValue );
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My first attempt was to pass the handler in the Spacer block but then I realised that it would require to add it in more blocks so a better solution was to make it optional.

Copy link
Contributor

@dratwas dratwas left a comment

Choose a reason for hiding this comment

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

Tested it on iOS and Android and everything works well. Thanks, @fluiddot for this PR!

Copy link
Member

@geriux geriux left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for fixing it!

@guarani
Copy link
Contributor

guarani commented Jan 5, 2021

Re-ran failing test 🤞

Update master branch from original repo
Range cell component is used in multiple components but not all of them require the onComplete handler so it should be optional.
@gziolo gziolo merged commit 58d0ddf into WordPress:master Jan 5, 2021
@github-actions github-actions bot added this to the Gutenberg 9.8 milestone Jan 5, 2021
@fluiddot fluiddot deleted the rnmobile/fix/range-cell-oncomplete-optional branch January 5, 2021 15:54
guarani pushed a commit that referenced this pull request Jan 5, 2021
Range cell component is used in multiple components but not all of them require the onComplete handler so it should be optional.
cameronvoell pushed a commit that referenced this pull request Jan 11, 2021
* Release script: Update react-native-editor version to 1.44.0

* Release script: Update with changes from 'npm run core preios'

* Mobile - Link settings - Fix data not being saved when closing the bottom sheet (#27997)

* Set onComplete handler as optional in Range cell component (#27987)

Range cell component is used in multiple components but not all of them require the onComplete handler so it should be optional.

* Mobile - Link settings - Check for onClose (#28039)

* Fix: Add Image style settings for hotlinked images (#28006)

* Update CHANGELOG.md (#28042)

* Change spaces back to tabs

Co-authored-by: Gerardo Pacheco <[email protected]>
Co-authored-by: Carlos Garcia <[email protected]>
Co-authored-by: Enej Bajgoric <[email protected]>
cameronvoell added a commit that referenced this pull request Jan 18, 2021
* Release script: Update react-native-editor version to 1.44.0

* Release script: Update with changes from 'npm run core preios'

* Mobile - Link settings - Fix data not being saved when closing the bottom sheet (#27997)

* Set onComplete handler as optional in Range cell component (#27987)

Range cell component is used in multiple components but not all of them require the onComplete handler so it should be optional.

* Mobile - Link settings - Check for onClose (#28039)

* Fix: Add Image style settings for hotlinked images (#28006)

* Update CHANGELOG.md (#28042)

* Change spaces back to tabs

* Release script: Update react-native-editor version to 1.44.1

* Release script: Update with changes from 'npm run core preios'

* [RNMobile] Fix crash in mobile paragraph  blocks with custom font size (#28121)

* Remove px suffix from fontSize for Android paragraph

* Issue does not seem to be limited to android on latest gutenberg master

* Move fontSize char removal to richtext to account for multiple block errors

* Add move to top bottom when long pressing block movers (#27554)

* WC: Added move to top and bottom functionality via long pressing BlockMover buttons and clicking the button on the BottomSheet Picker.

* WIP: Unit tests.

* WC: WIP unit tests for add move to top and bottom

* WC: Moving UI tests to gutenberg with other UI tests instead of keeping at gutenberg-mobile. Adding more convenience functions to EditorPage.

* WIP: Unit tests.

* WC: Adding icon and title to picker for move to top/bottom.

* WC: Cleaning up code.

* WC: Fixing merge issue where import was changed to const.

* WC: Changing all imports to requires as per jest bug.

* WC: Removing before/afterAll blocks from UI tests.

* WC: Removing e2e tests to issue-1191-add-move-to-top-bottom-ui-tests branch.

* WC: Updating imports to fall in line with other files.

Co-authored-by: Wendy Chen <[email protected]>

* Fixed crash introduced from recent fontSize fix (#28209)

* Updated changelog

Co-authored-by: Paul Von Schrottky <[email protected]>
Co-authored-by: Gerardo Pacheco <[email protected]>
Co-authored-by: Carlos Garcia <[email protected]>
Co-authored-by: Enej Bajgoric <[email protected]>
Co-authored-by: illusaen <[email protected]>
Co-authored-by: Wendy Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository 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.

Crash when changing spacing via text input in Spacer block
5 participants