Skip to content

Only reset textAncesor when is a child of text#36520

Closed
Ne3l wants to merge 1 commit into
facebook:mainfrom
Ne3l:main
Closed

Only reset textAncesor when is a child of text#36520
Ne3l wants to merge 1 commit into
facebook:mainfrom
Ne3l:main

Conversation

@Ne3l
Copy link
Copy Markdown

@Ne3l Ne3l commented Mar 18, 2023

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.

Before After
Screenshot 2023-03-08 at 23 06 12 Screenshot 2023-03-08 at 23 07 11

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Hi @Ne3l!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@analysis-bot
Copy link
Copy Markdown

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,519,160 -29
android hermes armeabi-v7a 7,834,751 -29
android hermes x86 8,999,088 -28
android hermes x86_64 8,854,093 -23
android jsc arm64-v8a 9,141,840 +1
android jsc armeabi-v7a 8,333,497 +2
android jsc x86 9,196,451 +8
android jsc x86_64 9,454,267 +14

Base commit: 4a05f68
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 18, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 21, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@javache merged this pull request in d92cfd5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants