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": string}, "eventPhase": Js.Nullable.t(float), [@bs.meth] "preventDefault": unit => unit, [@bs.meth] "isDefaultPrevented": unit => bool, [@bs.meth] "stopPropagation": unit => unit, [@bs.meth] "isPropagationStopped": unit => bool, "isTrusted": Js.Nullable.t(bool), "nativeEvent": 'a, [@bs.meth] "persist": unit => unit, "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) = { . // synthethicEvent keys "bubbles": Js.Nullable.t(bool), "cancelable": Js.Nullable.t(bool), "currentTarget": float, "defaultPrevented": Js.Nullable.t(bool), "dispatchConfig": {. "registrationName": string}, "eventPhase": Js.Nullable.t(float), [@bs.meth] "preventDefault": unit => unit, [@bs.meth] "isDefaultPrevented": unit => bool, [@bs.meth] "stopPropagation": unit => unit, [@bs.meth] "isPropagationStopped": unit => bool, "isTrusted": Js.Nullable.t(bool), "nativeEvent": 'a, [@bs.meth] "persist": unit => unit, "target": Js.Nullable.t(float), "timeStamp": float, "_type": Js.Nullable.t(string), "touchHistory": { . "indexOfSingleActiveTouch": float, "mostRecentTimeStamp": float, "numberActiveTouches": float, "touchBank": array({ . "touchActive": bool, "startPageX": float, "startPageY": float, "startTimeStamp": float, "currentPageX": float, "currentPageY": float, "currentTimeStamp": float, "previousPageX": float, "previousPageY": float, "previousTimeStamp": float, }), }, };

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 };