Commit 863f76b
Fix autoCapitalize bitmask collision with numeric inputType flags (facebook#55786)
Summary:
`setAutoCapitalize` applies `AUTOCAPITALIZE_FLAGS` (`0x7000`) to all input types, but this mask overlaps `TYPE_NUMBER_FLAG_SIGNED` (`0x1000`) and `TYPE_NUMBER_FLAG_DECIMAL` (`0x2000`). On every Fabric re-render, this strips the signed/decimal flags from numeric inputs, causing `commitStagedInputType` to call `setInputType()` with corrupted flags, which restarts the IME and breaks composing-based input (e.g. Samsung keyboards' shared `.`/`-` key).
The fix skips `setAutoCapitalize` for `TYPE_CLASS_NUMBER` inputs, where autocapitalize is meaningless.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Android] [Fixed] - Fix `setAutoCapitalize` stripping numeric `TextInput` flags (`TYPE_NUMBER_FLAG_SIGNED`/`DECIMAL`), affecting minus sign input on Samsung keyboards
Pull Request resolved: facebook#55786
Test Plan: A unit test was added to `ReactTextInputPropertyTest.kt` that verifies `setAutoCapitalize` does not strip `TYPE_NUMBER_FLAG_SIGNED` or `TYPE_NUMBER_FLAG_DECIMAL` when the input type class is `TYPE_CLASS_NUMBER`.
Reviewed By: javache
Differential Revision: D95049029
Pulled By: NickGerleman
fbshipit-source-id: 695b1394f7df04ace782319c5847b40bfd2a5d7f1 parent 9ebb325 commit 863f76b
3 files changed
Lines changed: 86 additions & 1 deletion
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/views/textinput
- test/java/com/facebook/react/views/textinput
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
722 | 724 | | |
723 | 725 | | |
724 | 726 | | |
| |||
882 | 884 | | |
883 | 885 | | |
884 | 886 | | |
| 887 | + | |
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
| |||
1129 | 1132 | | |
1130 | 1133 | | |
1131 | 1134 | | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1132 | 1157 | | |
1133 | 1158 | | |
1134 | 1159 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
128 | 187 | | |
129 | 188 | | |
130 | 189 | | |
| |||
0 commit comments