Skip to content

Merge RawText sequences#47278

Closed
javache wants to merge 1 commit into
facebook:mainfrom
javache:export-D65134912
Closed

Merge RawText sequences#47278
javache wants to merge 1 commit into
facebook:mainfrom
javache:export-D65134912

Conversation

@javache
Copy link
Copy Markdown
Member

@javache javache commented Oct 29, 2024

When we have multiple spans of text inside a element, React will emit these as separate RawText ShadowNodes. RawText shadow nodes cannot have any properties beyond the text they contain, yet our current AttributedText logic will generate a separate span for each and duplicate all the relevant properties.

This can be particularly inefficient when JSX is used to interpolate strings, e.g. <Text styles={styles.text}>Example {i}/{count}</Text> results in 4 raw text elements with duplicated properties.

Changelog: [General] Improved AttributedText generation for raw text nodes.

Differential Revision: D65134912

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D65134912

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported p: Facebook Partner: Facebook Partner labels Oct 29, 2024
Summary:
When we have multiple spans of text inside a <Text> element, React will emit these as separate RawText ShadowNodes. RawText shadow nodes cannot have any properties beyond the text they contain, yet our current AttributedText logic will generate a separate span for each and duplicate all the relevant properties.

This can be particularly inefficient when JSX is used to interpolate strings, e.g. `<Text styles={styles.text}>Example {i}/{count}</Text>` results in 4 raw text elements with duplicated properties.

Changelog: [General] Improved AttributedText generation for raw text nodes.

Reviewed By: NickGerleman

Differential Revision: D65134912
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D65134912

javache added a commit to javache/react-native that referenced this pull request Nov 8, 2024
Summary:

When we have multiple spans of text inside a <Text> element, React will emit these as separate RawText ShadowNodes. RawText shadow nodes cannot have any properties beyond the text they contain, yet our current AttributedText logic will generate a separate span for each and duplicate all the relevant properties.

This can be particularly inefficient when JSX is used to interpolate strings, e.g. `<Text styles={styles.text}>Example {i}/{count}</Text>` results in 4 raw text elements with duplicated properties.

Changelog: [General][Changed] Improved AttributedText generation for raw text nodes.

Reviewed By: NickGerleman

Differential Revision: D65134912
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 2f7957f.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Nov 8, 2024
@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @javache in 2f7957f

When will my fix make it into a release? | How to file a pick request?

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants