Commit dca86ce
Add font variation settings support to TextInput (#57805)
Summary:
Pull Request resolved: #57805
Extend Android `TextInput` support for the existing `fontVariationSettings` text style prop. Fabric now forwards changes and resets through `AndroidTextInputProps`, and `ReactTextInputManager` applies the normalized value to the underlying `ReactEditText` paint after typeface updates.
Using the `EditText` paint as the source of truth applies variable font axes consistently to placeholders, controlled values, and newly typed text. Equivalent `CustomStyleSpan`s are stripped while spans with different variation settings remain intact for attributed text ranges.
As with `<Text>`, common text attributes forward settings syntax unchanged and Android remains the validation authority. This avoids narrowing Android-compatible grammar; malformed settings are outside the supported inheritance contract. Both `normal` and the React Native empty-string convention explicitly reset variation settings.
Changelog:
[Android][Added] - Add `fontVariationSettings` support for `TextInput`
Reviewed By: Abbondanzo
Differential Revision: D1135804931 parent 978bdd0 commit dca86ce
6 files changed
Lines changed: 143 additions & 6 deletions
File tree
- packages/react-native
- Libraries/Components/TextInput
- ReactAndroid
- api
- src
- main/java/com/facebook/react/views/textinput
- test/java/com/facebook/react/views/textinput
- ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| 618 | + | |
618 | 619 | | |
619 | 620 | | |
620 | 621 | | |
| |||
714 | 715 | | |
715 | 716 | | |
716 | 717 | | |
| 718 | + | |
717 | 719 | | |
718 | 720 | | |
719 | 721 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6358 | 6358 | | |
6359 | 6359 | | |
6360 | 6360 | | |
| 6361 | + | |
6361 | 6362 | | |
6362 | 6363 | | |
6363 | 6364 | | |
| |||
Lines changed: 29 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| |||
646 | 652 | | |
647 | 653 | | |
648 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
649 | 663 | | |
650 | 664 | | |
651 | 665 | | |
| |||
662 | 676 | | |
663 | 677 | | |
664 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
665 | 682 | | |
666 | 683 | | |
667 | 684 | | |
668 | 685 | | |
669 | 686 | | |
670 | 687 | | |
671 | 688 | | |
672 | | - | |
| 689 | + | |
| 690 | + | |
673 | 691 | | |
674 | 692 | | |
675 | 693 | | |
| |||
822 | 840 | | |
823 | 841 | | |
824 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
825 | 847 | | |
826 | | - | |
| 848 | + | |
827 | 849 | | |
828 | | - | |
| 850 | + | |
829 | 851 | | |
830 | | - | |
| 852 | + | |
831 | 853 | | |
832 | 854 | | |
833 | 855 | | |
| |||
902 | 924 | | |
903 | 925 | | |
904 | 926 | | |
905 | | - | |
| 927 | + | |
| 928 | + | |
906 | 929 | | |
907 | 930 | | |
908 | 931 | | |
909 | 932 | | |
910 | 933 | | |
911 | 934 | | |
912 | | - | |
| 935 | + | |
913 | 936 | | |
914 | 937 | | |
915 | 938 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
| |||
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
497 | 499 | | |
498 | 500 | | |
499 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
500 | 594 | | |
501 | 595 | | |
502 | 596 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
326 | 330 | | |
327 | 331 | | |
328 | 332 | | |
| |||
622 | 626 | | |
623 | 627 | | |
624 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
625 | 637 | | |
626 | 638 | | |
627 | 639 | | |
| |||
0 commit comments