-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix Text borders not rendering. #5740
Conversation
Does this PR break refs? I think you would need to forward the ref to the inner Text element. Also, doesn't this PR break text flow layout if you try to put a border on a nested Text element? |
I'm also a little concerned about whether this will introduce JS behavior changes. We've been pretty bad about JS correctness issues when we've forked components, so it could be useful to have a short test plan here to understand if we're breaking scenarios. Some offline discussion earlier with Igor was that this is hard to paper over in native (@kmelmon having more context). Architecturally, we'd love to have native abstract over differences to the JS layer, which this change kind of goes against, but I don't have enough familiarity to understand why this is hard for native. I think it would be useful to understand architectural gaps here. |
Igor and I discussed the options for implementing this in native, they are all very complex/expensive to implement. Briefly those options were:
In reply to: 674347472 [](ancestors = 674347472) |
Do you have fixes for the issues I posted above? Wrapping an inner text with a view will break all kinds of things. |
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.
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.
Can you verify this simple sample?
<Text>This text is <Text style={{color:'red', borderWidth:1, borderColor:'black'}}>outlined</Text> and laid out within the normal text run, so will wrap etc as normal text.</Text>
I'm worried that this PR as is will break text. -- Its probably better to not have the border than break the apps layout.
@acoates-ms I'm verifying the nested text behavior - was going get back to you once I was done. I'll also try your sample :) I had also been thinking about refs - can you elaborate what exactly would break with this change and how to mitigate it? |
@acoates-ms You have a point - the nested Text doesn't render: |
The text component already has code to detect if its nested text or not. See the references to TextAncenstor within the text component. |
7b77267
to
bb7011b
Compare
@acoates-ms I've solved the edge case you pointed out, and added refs. See the updated PR description for a screenshot of your sample. :) Thanks for the tip about detecting nesting! |
@acoates-ms Applied all your suggestions re: avoiding unnecessary object spreads, passing along more margin props. |
1ee4188
to
4d8c70e
Compare
Handle nested text border.
@acoates-ms All CI checks passed, comments resolved. |
Forking the JS component until a native solution is workable.
Closes #5187
Microsoft Reviewers: Open in CodeFlow
EDIT:
While I was working on this PR, we ingested a portion of changes from RN, which included a new behaviour in View.js whereby TextAncestor gets reset in order to enable certain scenarios of nesting View inside Text (eg. inline vs block images). It's impossible on Windows anyway, so overriding in Text.windows.js that should be fine.