跳到主要内容
新架构实战课 实操 + 基建 + 原理全维度包揽,抢先掌握 React Native 新架构精髓 立即查看 >

LayoutEvent 对象类型

LayoutEvent 对象作为组件布局变化的结果在回调中返回,例如 View 组件中的 onLayout

示例

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

属性与值

height

布局变化后组件的高度。

TypeOptional
numberNo

width

布局变化后组件的宽度。

TypeOptional
numberNo

x

组件在父组件内的 X 坐标。

TypeOptional
numberNo

y

组件在父组件内的 Y 坐标。

TypeOptional
numberNo

target

接收 LayoutEvent 的元素的节点 ID。

TypeOptional
number, null, undefinedNo

被下列组件引用