-
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
[RNMobile] Add Group and Ungroup block actions #50693
[RNMobile] Add Group and Ungroup block actions #50693
Conversation
Most of the logic of this hook has been extracted from `ConvertToGroupButton` component. The main difference is that we return the configuration for the block actions instead of a component.
Size Change: 0 B Total Size: 1.39 MB ℹ️ View Unchanged
|
With these two new options, the block actions menu is getting a bit long. Maybe we could consider in the future reduce it by adding submenus. cc @osullivanchris |
@fluiddot the action sheet on iOS is starting to feel dated to me, as a component we use across the app. The iOS context menu is more condense and has different display options, so could manage this better. Even on Android we're using our own bottom sheet here, which is more condense than the action sheet. So could be an alternative option. I think it would be hard to provide two levels, particularly in the action sheet. As it would be hard to come up with a sensible name for any group of the actions. E.g. you could put copy, cut and duplicate into a group - but it would be very hard to come up with a clear name for that group. |
Thanks @osullivanchris for the feedback 🙇 !
Yep, I agree. It would be great to revamp it eventually. I hope we can focus on this in a next project 🤞 .
I found this library that might help us to start incorporating contextual menus in React Native: It could be a good starter to explore how to replace the action sheets.
True. In the web version, the block actions menu is also long. But obviously, we have plenty more space there. However, observe that some items are grouped in sections. |
@fluiddot yeah the context menu would be nice to explore at some point. Ah I misunderstood about groups. I thought you meant to have another layer of hierarchy as in group them into a single item, and take an extra step/tap. I see what you mean now. I have not used groups in action sheets before, but if its a pattern that we support I'm fine having subgroups here. If we don't support it already, I'm not sure its worthwhile adding a new variation of an action sheet. I'd rather we spend the effort to move to a different UI altogether like context menu or bottom sheet. |
Yeah, actually I meant that 😅. My comment was related to seeing what options we have to reduce the size of the block actions menu, but I didn't want to reference anything in particular.
I think the only subgroup pattern we currently have in action sheets is opening another sheet. As an example, you can check this when tapping on the "Transform ..." option. However, this option doesn't allow navigating back. As you mentioned, I agree that at this point, it would be great to explore a more solid approach like context menus. |
@fluiddot ah ok. So I was right the first time. As I said I just can't think of a sensible name for those groups of actions. I think we can just park it for now, accept the list is getting a bit too big, and its another data point to say we need a more modern component 😄 |
👋 Thanks for the PR! Is something blocking this PR? I get that you're discussing about exploring submenus in follow ups, no? It could be great to land this one and unblock this one. |
I think the design discussion is not really blocking the PR, any potential work in this regard will be done in the future. The main blocker at this point is the review and approval of the PR. I'll ping reviewers in case the PR went unnoticed. |
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.
@fluiddot, LGTM! I agree that it'd be good to revisit the UI in the future, perhaps as part of our upcoming UX improvement project :)
Functionally, the grouping/ungrouping works as expected on both Android and iOS, matching up to the web's behaviour. I don't see any blockers to this PR. Thanks for working on this, Carlos! 👏 🙌
) * Remove `unwrap` from transforms and add `ungroup` to more blocks * add docs * update e2e tests * add e2e test * Refactor useConvertToGroupButtonProps for readability * Apply suggestions from code review Co-authored-by: Miguel Fonseca <[email protected]> * update docs * reword ungrouping in docs * update e2e test * [RNMobile] Add Group and Ungroup block actions (#50693) * Add `useConvertToGroupButtons` hook Most of the logic of this hook has been extracted from `ConvertToGroupButton` component. The main difference is that we return the configuration for the block actions instead of a component. * Add Group and Ungroup options to block actions menu * Remove `canUnwrap` option from `getBlockTransformOptions` test helper * Update tests for Group, Quote and Columns blocks --------- Co-authored-by: Miguel Fonseca <[email protected]> Co-authored-by: Carlos Garcia <[email protected]>
What?
This PR incorporates the Group and Ungroup block actions to match the web version.
Why?
Currently, grouped blocks can be unwrapped via the
unwrap
transform option. This option will be removed in #50385 in favor of Ungroup block action. Hence, we need to incorporate it in the native version.How?
useConvertToGroupButtons
that returns the Group and Ungroup options to use in the block actions menu. The logic for this hook is very similar to theConvertToGroupButton
component, the main difference is that the latter returns a component.Testing Instructions
Group/Ungroup
Ungroup is not displayed on empty groups
Unwrap transform is not displayed
Group
,Quote
,Columns
blocks.unwrap
option is not displayed.Testing Instructions for Keyboard
N/A
Screenshots or screencast