Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Text page and add types, add LayoutEvent object page #2209

Merged
merged 1 commit into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ Invoked on load error with `{nativeEvent: {error}}`.

### `onLayout`

Invoked on mount and layout changes with `{nativeEvent: {layout: {x, y, width, height}}}`.
Invoked on mount and on layout changes.

| Type | Required |
| -------- | -------- |
| function | No |
| Type | Required |
| ------------------------------------ | -------- |
| ([LayoutEvent](layoutevent)) => void | No |

---

Expand Down
72 changes: 72 additions & 0 deletions docs/layoutevent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
id: layoutevent
title: LayoutEvent Object Type
---

`LayoutEvent` object is returned in the callback as a result of component layout change, for example `onLayout` in [View](view) component.

## Example

```js
{
layout: {
width: 520,
height: 70.5,
x: 0,
y: 42.5
},
target: 1127
}
```

## Keys and values

### `height`

Height of the component after the layout changes.

| Type | Optional |
| ------ | -------- |
| number | No |

### `width`

Width of the component after the layout changes.

| Type | Optional |
| ------ | -------- |
| number | No |

### `x`

Component X coordinate inside the parent component.

| Type | Optional |
| ------ | -------- |
| number | No |

### `y`

Component Y coordinate inside the parent component.

| Type | Optional |
| ------ | -------- |
| number | No |

### `target`

The node id of the element receiving the PressEvent.

| Type | Optional |
| --------------------------- | -------- |
| number, `null`, `undefined` | No |

## Used by

- [`Image`](image)
- [`Pressable`](pressable)
- [`ScrollView`](scrollview)
- [`Text`](text)
- [`TextInput`](textinput)
- [`TouchableWithoutFeedback`](touchablewithoutfeedback)
- [`View`](view)
Loading