Skip to content

Commit e2b8568

Browse files
authored
Add support for TargetEvent type in focus, blur callbacks (#4618)
1 parent 9cda4c9 commit e2b8568

4 files changed

Lines changed: 40 additions & 11 deletions

File tree

docs/layoutevent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Component Y coordinate inside the parent component.
5555

5656
### `target`
5757

58-
The node id of the element receiving the PressEvent.
58+
The node id of the element receiving the LayoutEvent.
5959

6060
| Type | Optional |
6161
| --------------------------- | -------- |

docs/targetevent.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
id: targetevent
3+
title: TargetEvent Object Type
4+
---
5+
6+
`TargetEvent` object is returned in the callback as a result of focus change, for example `onFocus` or `onBlur` in the [TextInput](textinput) component.
7+
8+
## Example
9+
10+
```
11+
{
12+
target: 1127
13+
}
14+
```
15+
16+
## Keys and values
17+
18+
### `target`
19+
20+
The node id of the element receiving the TargetEvent.
21+
22+
| Type | Optional |
23+
| --------------------------- | -------- |
24+
| number, `null`, `undefined` | No |
25+
26+
## Used by
27+
28+
- [`TextInput`](textinput)
29+
- [`TouchableWithoutFeedback`](touchablewithoutfeedback)

docs/textinput.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ Callback that is called when the text input is blurred.
565565

566566
> Note: If you are attempting to access the `text` value from `nativeEvent` keep in mind that the resulting value you get can be `undefined` which can cause unintended errors. If you are trying to find the last value of TextInput, you can use the [`onEndEditing`](textinput#onendediting) event, which is fired upon completion of editing.
567567
568-
| Type |
569-
| -------- |
570-
| function |
568+
| Type |
569+
| -------------------------------------------------------- |
570+
| `md ({nativeEvent: [TargetEvent](targetevent)}) => void` |
571571

572572
---
573573

@@ -639,7 +639,7 @@ Callback that is called when the text input is focused.
639639

640640
| Type |
641641
| -------------------------------------------------------- |
642-
| `md ({nativeEvent: [LayoutEvent](layoutevent)}) => void` |
642+
| `md ({nativeEvent: [TargetEvent](targetevent)}) => void` |
643643

644644
---
645645

docs/touchablewithoutfeedback.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,19 +424,19 @@ Used to locate this view from native code. Has precedence over `nativeID` prop.
424424

425425
Invoked when the item loses focus.
426426

427-
| Type |
428-
| -------- |
429-
| function |
427+
| Type |
428+
| -------------------------------------------------------- |
429+
| `md ({nativeEvent: [TargetEvent](targetevent)}) => void` |
430430

431431
---
432432

433433
### `onFocus`
434434

435435
Invoked when the item receives focus.
436436

437-
| Type |
438-
| -------- |
439-
| function |
437+
| Type |
438+
| -------------------------------------------------------- |
439+
| `md ({nativeEvent: [TargetEvent](targetevent)}) => void` |
440440

441441
---
442442

0 commit comments

Comments
 (0)