Skip to content

Latest commit

 

History

History
186 lines (148 loc) · 3.22 KB

File metadata and controls

186 lines (148 loc) · 3.22 KB
id title officialDoc
event
Event

These are the types of objects returned in Event callbacks. Types are instances of syntheticEvent<'a> and responderSyntheticEvent<'a>.

Parametrised Types

syntheticEvent<'a>

type syntheticEvent<'a> = {
  bubbles: Js.Nullable.t<bool>,
  cancelable: Js.Nullable.t<bool>,
  currentTarget: float,
  defaultPrevented: Js.Nullable.t<bool>,
  dispatchConfig: registrationName,
  eventPhase: Js.Nullable.t<float>,
  isTrusted: Js.Nullable.t<bool>,
  nativeEvent: T._payload,
  target: Js.Nullable.t<float>,
  timeStamp: float,
  _type: Js.Nullable.t<string>,
}

responderSyntheticEvent<'a>

responderSyntheticEvent<'a> adds the touchHistory key to syntheticEvent<'a>

type responderSyntheticEvent<'a> = {
  bubbles: Js.Nullable.t<bool>,
  cancelable: Js.Nullable.t<bool>,
  currentTarget: float,
  defaultPrevented: Js.Nullable.t<bool>,
  dispatchConfig: registrationName,
  eventPhase: Js.Nullable.t<float>,
  isTrusted: Js.Nullable.t<bool>,
  nativeEvent: T._payload,
  target: Js.Nullable.t<float>,
  timeStamp: float,
  _type: Js.Nullable.t<string>,
  touchHistory: touchHistory,
}

Types

layoutEvent

type layoutEvent = syntheticEvent<layout>

where layout is defined as

type layout = {
  x: float,
  y: float,
  width: float,
  height: float,
}

pressEvent

type pressEvent = responderSyntheticEvent<pressEventPayload>

where pressEventPayload is defined as

type pressEventPayload = {
  changedTouches: array(pressEventPayload),
  force: float,
  identifier: int,
  locationX: float,
  locationY: float,
  pageX: float,
  pageY: float,
  target: Js.Nullable.t(float),
  timestamp: float,
  touches: array(pressEventPayload),
}

scrollEvent

type scrollEvent = syntheticEvent<scrollEventPayload>

where scrollEventPayload is defined as

type scrollEventPayload = {
  contentInset,
  contentOffset,
  contentSize: dimensions,
  layoutMeasurement: dimensions,
}

and contentInset, contentOffset and dimensions are defined as

type contentInset = {
  bottom: float,
  left: float,
  right: float,
  top: float,
}
type contentOffset = {
  x: float,
  y: float,
}
type dimensions = {
  height: float,
  width: float,
}

switchChangeEvent

type switchChangeEvent = syntheticEvent<switchChangePayload>

where switchChangePayload is defined as

type switchChangePayload = {value: bool}

targetEvent

type targetEvent = syntheticEvent<targetPayload>

where targetPayload is defined as

type targetPayload = {target: int}

textLayoutEvent

type textLayoutEvent = syntheticEvent<textLayouts>

where textLayouts and textLayout are defined as

type textLayouts = {lines: array(textLayout)}

and

type textLayout = {
  x: float,
  y: float,
  width: float,
  height: float,
  ascender: float, // verify
  capHeight: float, // verify
  descender: float, // verify
  text: string,
  xHeight: float // verify
}