[0.65] Fixes Issues with Text backgroundColor #8490
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There were two issues with the Text backgroundColor prop:
Changes to the backgroundColor prop on virtual text nodes did not update their corresponding TextHighlighters
Changes to the underlying text did not update the TextHighlighter ranges
This change forces a refresh of all TextHighlighters any time:
A raw text node changes text value
A virtual text node is added or removed from the text tree
A virtual text or root text node updates its backgroundColor prop
TODOs:
Pass inherited foreground color down so virtual text highlighters apply the correct foreground color
Update snapshots since highlighter approach has changed
Produce a before and after video to ensure RNTester TextExample still works as expected
Add examples to RNTester to toggle background colors on RCTText and RCTVirtualText to see highlighter updates working
Add examples to RNTester to remove RCTRawText and RCTVirtualText nodes to see highlighter updates working
Backport #8408 to 0.65.
Microsoft Reviewers: Open in CodeFlow