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

[Mobile] Cover: Add Media Button when only colour is selected #23878

Merged
merged 68 commits into from
Jul 28, 2020

Conversation

antonis
Copy link
Member

@antonis antonis commented Jul 10, 2020

Fixes #23877 (parent wordpress-mobile/gutenberg-mobile#2275)

Related PRs:

This PR depends on #23870

Description

An image icon button has been added at the top-left of the component. When pressed the add media options are presented.

How has this been tested?

  • Add a cover block
  • Press on a colour from the palette
  • Verify that a new cover block with only colour is created
  • Verify that the new icon is presented at the top-left of the component
  • Tap on the icon and verify that the add media options are presented
  • Add a media and verify that it is applied in the background

Screenshots

Screenshot Functionality
Simulator Screen Shot - iPhone 11 - 2020-07-10 at 18 51 16 app

Types of changes

Enhancement

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.

@antonis antonis 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 Jul 14, 2020
@antonis antonis self-assigned this Jul 14, 2020
@antonis antonis linked an issue Jul 14, 2020 that may be closed by this pull request
@antonis antonis added [Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement. labels Jul 14, 2020
@antonis
Copy link
Member Author

antonis commented Jul 23, 2020

Thank you for the feedback @iamthomasbishop :)

I updated the button design and changed the text label.
Since the MediaUpload bottom sheet component already had a text for this I kept it "Choose image or video"

"Light background Dark background
Simulator Screen Shot - iPhone 11 - 2020-07-23 at 10 10 29 Simulator Screen Shot - iPhone 11 - 2020-07-23 at 10 05 25

@iamthomasbishop
Copy link

I updated the button design and changed the text label.
Since the MediaUpload bottom sheet component already had a text for this I kept it "Choose image or video"

Perfect. Thank you @antonis !

@antonis antonis marked this pull request as draft July 24, 2020 10:12
@antonis antonis force-pushed the rnmobile/CoverAddImageButton branch from 7e52411 to 1c53bdd Compare July 24, 2020 14:12
@antonis antonis requested review from geriux and mkevins July 24, 2020 14:18
@antonis antonis marked this pull request as ready for review July 24, 2020 15:01
Copy link
Contributor

@mkevins mkevins left a comment

Choose a reason for hiding this comment

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

This is looking pretty good. I tested on Android, and the logic is working as expected. There is one issue with the button size / container size that makes tapping difficult. It seems that the tappable area is small, and offset from the button itself:

I inspected the layout and it seems that the views are rendered outside their container (so they don't capture the event). E.g. the red rectangle is the outer view and the blue one is the child view:
add-image-button-out-of-container

It seems that aside from being offset, the size of the touchable is that of the inner view (inner view, e.g. icon, is the red rectangle):
add-image-button-inner-view

I tried locally changing the order (so TouchableWithoutFeedback wraps View), but the problem still persisted, so perhaps a change is needed elsewhere, either instead of or in addition to that.

{ renderBackground( getMediaOptions ) }
{ isParentSelected &&
hasOnlyColorBackground &&
addMediaButton( openMediaOptionsRef.current ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to pass this here? Maybe we can use it directly in addMediaButton. Wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello @mkevins 👋
thank you for your feedback, I really appreciate it :)
You are right, the parameter can be accessed directly. I updated the PR changing this and fixing the tappable area.

@antonis antonis requested a review from chipsnyder July 27, 2020 06:10
Copy link
Contributor

@mkevins mkevins 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 and it's working correctly now. Nice work @antonis ! 🎉

I left one minor suggestion (as a patch, since the GitHub diff context couldn't capture it as a "one-click-suggestion"), not a blocker though.

packages/block-library/src/cover/edit.native.js Outdated Show resolved Hide resolved
@antonis antonis merged commit a483555 into WordPress:master Jul 28, 2020
@github-actions github-actions bot added this to the Gutenberg 8.7 milestone Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mobile] Cover: Add Media Button when only colour is selected
3 participants