PressEvent 对象类型
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
PressEvent 对象作为用户按压交互的结果在回调函数中返回,例如 Button 组件中的 onPress 事件。
示例
js
{
changedTouches: [PressEvent],
identifier: 1,
locationX: 8,
locationY: 4.5,
pageX: 24,
pageY: 49.5,
target: 1127,
timestamp: 85131876.58868201,
touches: []
}
键与值
changedTouches
自上次事件以来发生改变的所有 PressEvent 组成的数组。
| Type | Optional |
|---|---|
| array of PressEvents | No |
force iOS
在 3D Touch 按压期间使用的压力值。返回一个浮点数,范围从 0.0 到 1.0。
| Type | Optional |
|---|---|
| number | Yes |
identifier
分配给该事件的唯一数字标识符。
| Type | Optional |
|---|---|
| number | No |
locationX
触摸事件在可触摸区域内的 X 坐标(相对于元素)。
| Type | Optional |
|---|---|
| number | No |
locationY
触摸事件在可触摸区域内的 Y 坐标(相对于元素)。
| Type | Optional |
|---|---|
| number | No |
pageX
触摸事件在屏幕上的 X 坐标(相对于根视图)。
| Type | Optional |
|---|---|
| number | No |
pageY
触摸事件在屏幕上的 Y 坐标(相对于根视图)。
| Type | Optional |
|---|---|
| number | No |
target
接收 PressEvent 的元素的节点 ID
| Type | Optional |
|---|---|
number, null, undefined | No |
timestamp
PressEvent 发生的时间戳值。该值以毫秒表示。
| Type | Optional |
|---|---|
| number | No |
touches
屏幕上所有当前 PressEvent 组成的数组。
| Type | Optional |
|---|---|
| array of PressEvents | No |