react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Fixes various issues with fast text optimization

Open rozele opened this issue 3 years ago • 1 comments

Description

Type of Change

Erase all that don't apply.

  • Bug fix (non-breaking change which fixes an issue)

Why

In #10354, a few scenarios are described where unexpected text changes occur out of sync with the shadow tree from RN, and some scenarios even crash the app.

Resolves #10354

What

This change ensures that we only use the fast text optimization when there is exactly one raw text child in the shadow tree, and also switches out of the fast text optimization when the number of children increases to greater than 1, rather than only when a text value is appended (i.e., we also have to switch out of fast text optimization when for a child that might be prepended at index 0).

Testing

Before:

https://user-images.githubusercontent.com/1106239/182199687-270b86d1-f347-4cd4-9df5-9cf576e8dda3.mp4

After:

https://user-images.githubusercontent.com/1106239/182199155-0d12d584-c94f-4b56-aaca-cd724c62413a.mp4

Microsoft Reviewers: Open in CodeFlow

rozele avatar Aug 01 '22 16:08 rozele

Just as an FYI, there was a previous fix to this code in #8822, but that only resolved the case where the fast text node was removed.

rozele avatar Aug 01 '22 16:08 rozele