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

Replace the commit hook with a wrapper component based on display: contents #566

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

j-piasecki
Copy link
Collaborator

@j-piasecki j-piasecki commented Dec 6, 2024

Details

React Native 0.77 comes with support for display: contents which would allow to make a wrapper component that doesn't impact layout in any way. This can be used to replace the commit hook to apply markdown styles without cloning the tree.

Important

display: contents is only supported on the new architecture. Merging this means dropping support for the old arch.

Related Issues

GH_LINK

Manual Tests

Linked PRs

Comment on lines 78 to 79
const auto &mutableChild =
std::const_pointer_cast<TextInputShadowNode>(child);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logic here (not specifically these lines, in general) assumes that if the decorator node is mutable, the child text input is also mutable. I'm not actually sure whether this assumption always holds true.

It may make sense to check the children in the constructor and clone them if fragment.children is null and the children list is not empty to ensure the child is mutable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be fine? Rerendering the decorator node should also rerender the text input underneath.

@j-piasecki j-piasecki force-pushed the @jpiasecki/display-contents branch from 0edb26e to 26f8433 Compare March 4, 2025 20:52
@j-piasecki j-piasecki marked this pull request as ready for review March 6, 2025 19:11
@j-piasecki j-piasecki requested a review from tomekzaw March 6, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant