From a817c6404338b7b15aaeac5693ae3635a0a3dde0 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Sun, 25 Feb 2018 23:13:35 -0800 Subject: [PATCH] RN: Use `$ReadOnly` in CoreEventTypes Reviewed By: sahrens Differential Revision: D7082715 fbshipit-source-id: d2f7e280d02bbd8e7dcba2d38b719fa4f82ecb8b --- Libraries/Types/CoreEventTypes.js | 99 ++++++++++++++++--------------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/Libraries/Types/CoreEventTypes.js b/Libraries/Types/CoreEventTypes.js index d0839cf46f84ea..012deaf6bf082f 100644 --- a/Libraries/Types/CoreEventTypes.js +++ b/Libraries/Types/CoreEventTypes.js @@ -11,55 +11,60 @@ 'use strict'; -export type Layout = {| - +x: number, - +y: number, - +width: number, - +height: number, -|}; -export type LayoutEvent = SyntheticEvent<{| - +layout: Layout, +export type SyntheticEvent = $ReadOnly<{| + bubbles: ?boolean, + cancelable: ?boolean, + currentTarget: number, + defaultPrevented: ?boolean, + dispatchConfig: $ReadOnly<{| + registrationName: string, + |}>, + eventPhase: ?number, + isDefaultPrevented: () => boolean, + isPropagationStopped: () => boolean, + isTrusted: ?boolean, + nativeEvent: T, + persist: () => void, + target: ?number, + timeStamp: number, + type: ?string, |}>; -export type SyntheticEvent = {| - +bubbles: ?boolean, - +cancelable: ?boolean, - +currentTarget: number, - +defaultPrevented: ?boolean, - +dispatchConfig: {| - +registrationName: string, - |}, - +eventPhase: ?number, - +isDefaultPrevented: () => boolean, - +isPropagationStopped: () => boolean, - +isTrusted: ?boolean, - +nativeEvent: T, - +persist: () => void, - +target: ?number, - +timeStamp: number, - +type: ?string, -|}; +export type Layout = $ReadOnly<{| + x: number, + y: number, + width: number, + height: number, +|}>; + +export type LayoutEvent = SyntheticEvent< + $ReadOnly<{| + layout: Layout, + |}>, +>; export type PressEvent = SyntheticEvent; -export type ScrollEvent = SyntheticEvent<{| - +contentInset: {| - +bottom: number, - +left: number, - +right: number, - +top: number, - |}, - +contentOffset: {| - +y: number, - +x: number, - |}, - +contentSize: {| - +height: number, - +width: number, - |}, - +layoutMeasurement: {| - +height: number, - +width: number, - |}, - +zoomScale: number, -|}>; +export type ScrollEvent = SyntheticEvent< + $ReadOnly<{| + contentInset: $ReadOnly<{| + bottom: number, + left: number, + right: number, + top: number, + |}>, + contentOffset: $ReadOnly<{| + y: number, + x: number, + |}>, + contentSize: $ReadOnly<{| + height: number, + width: number, + |}>, + layoutMeasurement: $ReadOnly<{| + height: number, + width: number, + |}>, + zoomScale: number, + |}>, +>;