-
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
[RNMobile] Add Cover Block media settings #25810
Conversation
217218c
to
d86f12d
Compare
ac36705
to
658acf0
Compare
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.
Hey @shadow351 👋 just gave this I quick look at the code and its going on the right direction 👍
Just left two minor comments but I'll do a further review when it's ready for review.
Thanks!
17fcf08
to
8814cef
Compare
I can help here, I'd really prefer to make the tooltip shared even if it's just the basic functionality of it. Can you elaborate a bit more about the issues you had? Thanks! |
@geriux thanks for the help. First, in which directory should I place this shared tooltip component if I intend to share it between the page templates and focal point picker?
Third, I noticed a few differences between the use cases that caused me to pause sharing the code. I welcome your thoughts and opinions on whether you believe it is still worthwhile to share the code.
Placing the current <BottomSheet>
<FocalPointGroup> /* absolutely positioned based on focal point coordinates */
<Tooltip /> /* overlay unable to "break out" of FocalPointGroup */
<FocalPointIcon />
</FocalPointGroup>
</BottomSheet> Placing the current <BottomSheet>
<Tooltip /> /* not within FocalPointGroup, so does not know coordinate position to match */
<FocalPointGroup> /* absolutely positioned based on focal point coordinates */
<FocalPointIcon />
</FocalPointGroup>
</BottomSheet> I have not fully explored the feasibility of these options, but here are the ideas I have thus far for sharing a tooltip between the two use cases. Option 1Expand the current <BottomSheet>
<Tooltip placement={{ x: focalPoint.x, y: focalPoint.y }} />
<FocalPointGroup placement={{ x: focalPoint.x, y: focalPoint.y }}>
<FocalPointIcon />
</FocalPointGroup>
</BottomSheet> Option 2Rather than including the overlay within <BottomSheet>
<Tooltip.Overlay style={{ height: '100%', width: '100%' }}>
{({ visible }) => (
<FocalPointGroup placement={{ x: focalPoint.x, y: focalPoint.y }}>
<Tooltip visible={visible} />
<FocalPointIcon />
</FocalPointGroup>
)}
</Tooltip.Overlay>
</BottomSheet> A third option may be something simpler that shares the basic functionality, as you stated. I'd be curious to hear what you are picturing. Let me know what you think. Thanks! |
@geriux I refactored my tooltip in this branch to match the expectations that tapping anywhere should dismiss the modal (per Thomas' request). I then explored a variation of the tooltip that would allow using it for both use cases — page templates and focal point picker. The exploration is still rough, but I can clean it up more if you believe it is worth pursuing. My thoughts on it are the it definitely expands the tooltip API surface area and adds complexity. I am not sure if it provides meaningful value at this point with only two points of usage. Part of me wonders if we should wait to see if more use cases arise before settling on an API for a shared tooltip. What do you think? |
1833cef
to
a1c78d2
Compare
d59db4c
to
14b6b1d
Compare
Previously, it was impossible to select the edit image button, as it was rendered beneath the image itself.
@iamthomasbishop I'm going to reverse course on a "Touchable Cell" that triggers the ActionSheet/menu. From building it out, I've discovered there is an issue in the bottom sheet that causes it to not appropriately disregard taps on buttons when the bottom sheet scrolls. I.e. it triggers a button tap even if you are swiping to scroll. To be clear, this issue appears to already exist for all buttons in the bottom sheet, but the large height/width of the new focal point preview cell exacerbates the issue as it is much easier to trigger this scenario. I am happy to create a separate issue for the button sensitivity in the bottom sheet. How do you feel about postponing this "Touchable Cell" change and retain the smaller edit image button for the time being? Video of bottom sheet sensitivityerroneous-bottom-sheet-touch.movAdditionally, here is an example of what Horizontal Overflow visibility for the focal point cross-hair looks like: Also, from playing with Vertical Overflow visibility, it feels a bit awkward for the cross-hair to sit atop the button beneath. Aside from the side effects and testing concerns I mentioned for the bottom cell, this awkwardness may be a reason to avoid Vertical Overflow visibility. Thoughts? |
Align with image edit button found within the canvas.
This allows dismissing the bottom sheet _after_ the second picker, rather than before it. This is helpful for the scenario where a user cancels the first picker. Now the bottom sheet will still be open in that scenario.
The related menu also provides the ability to clear the media.
Previously, voice over would announce nothing when selecting this button, as it did not have a label or hint.
Thanks @dcalhoun!
Sounds good, thank you for investigating!
Fixing the horizontal overflow makes a big difference, I'm much less concerned about the vertical, so yes we can worry about that in a separate pass.
That makes sense, let's defer that for another time. Just thinking out loud, we could potentially just drop the user on the top-level sheet and show a hint of some sort (perhaps something like the little pulsing blue dots that we show for Quick Start after the site creation flow).
I was thinking yes, in the spirit of consistency. While I tend to prefer not duplicating entry points if possible, if we're going to use the same edit menu component in multiple places, it would make sense for those actions to be consistent.
Definitely, fine to defer on that as well.
Ahh, that's right, I had forgotten about that interaction issue. I'm fine with deferring that one to another day as well.
I see what you mean. That's totally fine to let the button sit "over" the cross-hair, seems like a reasonable trade-off. I think I covered all of your questions, but let me know if I missed or need to clarify anything 😄 |
@iamthomasbishop thank you. You have answered all my questions. I will move forward seeking final code review and merge this work. If you'd like for me to hold off to allow you to review another build or have further discussion, just let me know. 😃 |
@geriux I believe this is ready for another code review. All the sibling PRs have been updated, including installable builds. Please let me know if there is anything else I need to do. Thanks! |
packages/components/src/mobile/image/image-editing-button.native.js
Outdated
Show resolved
Hide resolved
Avoid a static English string.
Address styling oddities for images and videos within the focal point settings. Namely, Android would render videos with the incorrect width, overflowing the parent container.
Rendering `react-native-video` with `paused` set to `true` causes the video to not render visibly on Android only. This is presumably related to other issues regarding `paused`. https://git.io/Jt6Dr By seeking the video to 0, the video correctly renders on Android.
@geriux I have addressed the a11y string issue and the missing video within the inspector for Android. This should be ready for review again. New builds are available on the sibling branches. Thanks! |
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! Nice work @dcalhoun! 🎉 👏
This was a complex task and I'm so happy it's finally ready to be merged! Thank you for all the changes.
Can you add this new feature to the release notes before merging? Thanks!
Tested on both iOS and Android.
👋 @dcalhoun , this might be a naive question: as I'm trying to understand the two different components named |
@hypest the former is the button in the parent sheet used to navigate to the focal point picker. The latter is the focal point picker itself, which is the child sheet. I agree that more explicit naming would be helpful. IIRC I attempted to inline the latter into its parent, but navigation would not work. I never identified why that was. It likely related to the absence of a React Navigation context. Hence, it was moved into a separate file and confusingly named. Long-term, the ideal would be to refactor this work to leverage the new |
Aha, I see now, thanks for elaborating David! With us still relying quite a bit on search-in-files for navigating the codebase, I think it would pay off if we try to do some renaming here, though not a high priority by any measure. |
Description
Addresses wordpress-mobile/gutenberg-mobile#1741 by adding the ability to edit the cover block focal point and toggle fixed position backgrounds.
I opted to rely upon React Native's
PanResponder
for the drag handle in the focal point editor. I attempted to rely uponreact-native-gesture-handler
, but incompatibility with Android modals forced me to rely uponPanResponder
.To support applying a max-height constraint (instead of a fill-parent strategy that all other images currently use) to an unknown sized image, I expanded the API of the existing
Image
component to broadcast when the image sizing metadata was known. This allows avoiding a collapsed element while the image loads.How has this been tested?
User Test Cases
User case 1
User case 2
User case 3
Screenshots
UX Interaction
ios-focal-point.mov
android-focal-point.mov
iOS Screenshots
Android Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: