Commit 9b6cbb7
Add selection types to TextInput onChange event (facebook#55043)
Summary:
This change adds TypeScript/Flow types and RNTester examples for the `selection` data in `TextInput.onChange` event.
This is the JS companion to the native changes that add selection data to the onChange event.
## Why
On the web, text input elements provide `selectionStart` and `selectionEnd` properties that are always accessible during input events. This change exposes the selection data that native now provides, allowing developers to access cursor position during onChange.
## What Changed
1. **Flow Types**: Added optional `selection?: Selection` to `TextInputChangeEventData`
2. **TypeScript Types**: Updated `ReactNativeApi.d.ts` with selection type
3. **RNTester**: Updated examples to display selection in event logs
## Changelog
[General][Added] - TextInput onChange event types now include optional selection data
Differential Revision: D901232941 parent 8a0b4c3 commit 9b6cbb7
File tree
3 files changed
+14
-5
lines changed- packages
- react-native
- Libraries/Components/TextInput
- rn-tester/js/examples/TextInput
3 files changed
+14
-5
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
5277 | 5277 | | |
5278 | 5278 | | |
5279 | 5279 | | |
| 5280 | + | |
5280 | 5281 | | |
5281 | 5282 | | |
5282 | 5283 | | |
| |||
6189 | 6190 | | |
6190 | 6191 | | |
6191 | 6192 | | |
6192 | | - | |
| 6193 | + | |
6193 | 6194 | | |
6194 | | - | |
| 6195 | + | |
6195 | 6196 | | |
6196 | 6197 | | |
6197 | 6198 | | |
6198 | 6199 | | |
6199 | 6200 | | |
6200 | | - | |
| 6201 | + | |
6201 | 6202 | | |
6202 | 6203 | | |
6203 | 6204 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
397 | 404 | | |
398 | 405 | | |
399 | 406 | | |
| |||
0 commit comments