-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Page template previews #19106
Page template previews #19106
Conversation
- BlockEditorProvider needs an update so it uses the subRegistry - We need a better way to only render the picker on the main block list - We need to make the bottom sheet full height, and adapt the block preview accordingly
The issue here is performance, the animation of the Modal is being affected by the blocks rendering. Do we use skeleton placeholders? I think this feature would benefit from it especially on slower/low-end devices. What do you think? |
Sounds good! |
Nice to see this, @koke!
That does look a bit odd. At first glance, I was going to ask if we could use the same screen transition we use on other full-screen dialogs on Android that we use elsewhere (the subtle scale as the window fades in), but it sounds like this could be at least partially due to a performance issue that Gerardo mentioned.
Where is this style coming from? I can replicate this in Figma and start using it where necessary (and define usage guidelines in the design docs). Will this header style remain in place when we start using the native style of the modal sheet on iOS, or will we inherit another style header (similar to the native I really would love to go to that new modal bottom sheet sooner rather than later so we can take advantage of the swipe-to-dismiss functionality of the native sheets. Android is less critical to have that considering we always have an OS-level back gesture. One other question, out of curiosity: is it possible to substitute the
I believe the icon and header title are both white in dark mode, but can we reference WPiOS to double-check? The background of the header should also match that of WPiOS, if possible – although I think we're using a dynamic system color so we might have to mimic the default color.
@geriux I think skeleton placeholders would be nice to see universally for an initial "loading" state, and I proposed something similar recently. |
Nice! Yes, that would be perfect for this case 😃 |
Happy to hear it's "just" a performance issue. I can't wait for Suspense to handle stuff like this more easily. I generally like skeleton placeholders, but there's something odd about them for a preview like this one. Even if we are using actual blocks to render, it feels more like we are loading the preview of a web page, and I think I would expect everything to load at once. Also, for devices that are performant enough I wouldn't want to show a placeholder while the modal animation is happening if the real content can be rendered fast enough, and I'm not sure how to tell the difference without going too deep into react native. |
I've just merged #19307 sorry for the conflicts 😅 |
@koke that is slow 😬 I do think skeletons would make it feel less cumbersome, but it won't completely mask the slowness. |
That's in prod mode, right? What specs does that device have? (I know it's not actually related to the PR but now I'm curious 😅) |
That's a Moto G5 Plus 😁 |
Sorry for being late to test this one. I gave it a try today with WPiOS, WPAndroid. I have no blocker findings except for the dark mode and it is a known issue.
And on Android rotating the device can cause the editor close altogether sometimes, not every time though, and this can be considered as a edge case:
the difference of bouncing during scrolling, on iOS is it bouncing but on Android it is not. Not sure if we can control this since we use a library to display modals. iPhoneXS, iOS 13 Huawei P20 lite, Android 9 Another thing is we have an overlap on Landscape mode but I think this is normal since we stick the template pickers on keyboard. I also gave it a try on iPad simulator and things seem normal: Code-wise, it looks ok to me. I'd just hope we wouldn't need to implement ModalHeaderBar but 🤷♂️Great job 🎉 |
@koke I'm not sure if this is the right ticket to drop design feedback on, but I've got some feedback on the header specifically (some of which I mentioned last week) 😄 :
Here are some exploratory mocks w/ different header variations: |
Yup, I have this draft PR that I will have ready for review today (don't mind the style changes you mentioned above in the draft PR because they're probably going to be updated in this one or in a new one =) |
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! Great job @koke ! 🎉 Approving since the styles improvements will be worked on in another PR.
Tested it on both iOS and Android ✅
]; | ||
|
||
export default defaultTemplates; | ||
const parsedTemplates = memoize( () => defaultTemplates.map( ( template ) => ( { |
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.
This is super nice! 👌🏻
const withRegistry = createHigherOrderComponent( | ||
( OriginalComponent ) => ( props ) => ( | ||
<RegistryConsumer> | ||
{ ( registry ) => ( | ||
<OriginalComponent | ||
{ ...props } | ||
registry={ registry } | ||
/> | ||
) } | ||
</RegistryConsumer> | ||
), | ||
'withRegistry' | ||
); |
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.
Nice clean up in favor of withRegistryProvider
👏
Created wordpress-mobile/gutenberg-mobile#1777 with the style feedback to work on a separate PR |
Description
This implements a first version of the template previews defined in wordpress-mobile/gutenberg-mobile#1466
After much wrestling with
BottomSheet
and react-native-modal, I couldn't find a good way to have a bottom sheet with aFlatList
inside that scrolled properly. So, for now, I switched to react-native's standardModal
.Once facebook/react-native#27618 lands on a release, we will be able to use the bottom-sheet style modals for iOS, but a cross platform solution will require more effort that's in scope for this feature.
This PR also includes some changes needed to
BlockEditorProvider
although I extracted those into #19120 for easier review.This also introduces a "new"
ModalHeaderBar
component to show as a top bar for modals. The code came from an existing title bar in theBottomSheet
code, but I haven't found any current examples of that being used in a bottom sheet. @iamthomasbishop this will need adjusting for dark mode, not sure what the colors should be there for the bar, title and close button.@geriux I've also moved the template picker to the bottom on this PR because I needed it out of the block list. I was getting into trouble because the preview also has a block list and a BlockFooterSlot. I think I prefer your approach in #19307, and that one should replace this once merged.
So this is blocked on those three changes (BlockEditorPreview, dark mode, and moving the toolbar), but I'm about to take a week off and the bulk of the PR is ready for review
gutenberg-mobile PR: wordpress-mobile/gutenberg-mobile#1676
How has this been tested?
I tested this by forcing a
postType=page
and empty content in gutenberg-mobilesrc/index.js
Screenshots
🤔 The modal animation looks odd to me on Android, but I'm not sure what's going on there and if that's normal.
Checklist: