Commit 91790e2
authored
[TextInput] Export TI State's focusInput/blurInput (#2460)
[These two
functions](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L60C1-L70C2)
are used to [properly handle onFocus\onBlur for TextInput
implementations](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1623C1-L1635C5),
specifically they are used to track the currently focused TextInput
control and as such cause
[focusTextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L106C1-L106C48)
and
[blurTextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L143C1-L143C69)
to skip native focus\blur calls if the JS side thinks the control in
question is already focused\blurred.
In other words, if someone wants to build a custom `<TextInput>` from
the ground up, they can't expect `focusTextInput`, `blurTextInput`, and
`currentlyFocusedInput` (the last one which is especially already used
in a bunch of places in the framework) to work properly. This change
exports the necessary `focusInput` and `blurInput` out of
[TextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInput.js#L2041C1-L2048C3)
statics.1 parent 2be9da2 commit 91790e2
File tree
4 files changed
+26
-0
lines changed- packages/react-native/Libraries
- Components/TextInput
- __tests__/__snapshots__
4 files changed
+26
-0
lines changedLines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1092 | 1108 | | |
1093 | 1109 | | |
1094 | 1110 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1255 | 1255 | | |
1256 | 1256 | | |
1257 | 1257 | | |
| 1258 | + | |
| 1259 | + | |
1258 | 1260 | | |
1259 | 1261 | | |
1260 | 1262 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2045 | 2045 | | |
2046 | 2046 | | |
2047 | 2047 | | |
| 2048 | + | |
| 2049 | + | |
2048 | 2050 | | |
2049 | 2051 | | |
2050 | 2052 | | |
| |||
2053 | 2055 | | |
2054 | 2056 | | |
2055 | 2057 | | |
| 2058 | + | |
| 2059 | + | |
2056 | 2060 | | |
2057 | 2061 | | |
2058 | 2062 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3303 | 3303 | | |
3304 | 3304 | | |
3305 | 3305 | | |
| 3306 | + | |
| 3307 | + | |
3306 | 3308 | | |
3307 | 3309 | | |
3308 | 3310 | | |
| |||
3702 | 3704 | | |
3703 | 3705 | | |
3704 | 3706 | | |
| 3707 | + | |
| 3708 | + | |
3705 | 3709 | | |
3706 | 3710 | | |
3707 | 3711 | | |
| |||
0 commit comments