Only reset textAncesor when is a child of text#36520
Conversation
|
Hi @Ne3l! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Base commit: 4a05f68 |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary
Text need to know if is a descendant of a text in order to proper render nested text. For this react-native uses the textAncestor provider #29736 (comment).
This provides a not so ideal DX when profiling/Debugging as the view is polluted with TextAncestor.provider on each view render (As is the main render piece this happens quite often).
The idea behind of this PR is to just reset the context when view is a descendant of a text (Not so common case) rather than resetting all the time.
From my understanding of how hooks works this shouldn't degrade the performance and didn't spot any diff profiling my app (For better or worse).
Changelog
[INTERNAL] [CHANGED] - Only reset textAncesor when is a child of text
Test Plan
https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextExample.ios.js