Repository navigation
Commit 37b84be
Avoid copying text fragments and re-attributing runs when building NSAttributedString
`RCTNSAttributedStringFromAttributedString` iterated the fragments by value,
copying each one (its string, its text attributes and a shadow view with
three shared pointers), and attached the event emitter to a text fragment in
a second `addAttributes:range:` pass over the string it had just created with
its attributes, which splits and re-merges the attribute runs. Iterate by
reference and put the emitter into a text fragment's initial attribute
dictionary. Attachment fragments keep the existing second pass, so the
attributes on every run are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent 96dddb0 commit 37b84be
1 file changed
Lines changed: 16 additions & 8 deletions
File tree
- packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| |||
427 | 428 | | |
428 | 429 | | |
429 | 430 | | |
430 | | - | |
431 | | - | |
432 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
433 | 439 | | |
434 | 440 | | |
435 | 441 | | |
436 | 442 | | |
437 | 443 | | |
438 | 444 | | |
439 | 445 | | |
440 | | - | |
| 446 | + | |
| 447 | + | |
441 | 448 | | |
442 | | - | |
443 | | - | |
| 449 | + | |
| 450 | + | |
444 | 451 | | |
| 452 | + | |
445 | 453 | | |
446 | 454 | | |
447 | 455 | | |
| |||
464 | 472 | | |
465 | 473 | | |
466 | 474 | | |
467 | | - | |
| 475 | + | |
468 | 476 | | |
469 | 477 | | |
470 | 478 | | |
| |||
0 commit comments