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

点击事件对象

PressEvent object is returned in the callback as a result of user press interaction, for example onPress in Button component.

示例

{
changedTouches: [PressEvent],
identifier: 1,
locationX: 8,
locationY: 4.5,
pageX: 24,
pageY: 49.5,
target: 1127,
timestamp: 85131876.58868201,
touches: []
}

Keys and values

changedTouches

Array of all PressEvents that have changed since the last event.

TypeOptional
array of PressEventsNo

force
iOS

Amount of force used during the 3D Touch press. Returns the float value in range from 0.0 to 1.0.

TypeOptional
numberYes

identifier

Unique numeric identifier assigned to the event.

TypeOptional
numberNo

locationX

Touch origin X coordinate inside touchable area (relative to the element).

TypeOptional
numberNo

locationY

Touch origin Y coordinate inside touchable area (relative to the element).

TypeOptional
numberNo

pageX

Touch origin X coordinate on the screen (relative to the root view).

TypeOptional
numberNo

pageY

Touch origin Y coordinate on the screen (relative to the root view).

TypeOptional
numberNo

target

The node id of the element receiving the PressEvent.

TypeOptional
number, null, undefinedNo

timestamp

Timestamp value when a PressEvent occurred. Value is represented in milliseconds.

TypeOptional
numberNo

touches

Array of all current PressEvents on the screen.

TypeOptional
array of PressEventsNo

被下列组件引用