Skip to content

Commit

Permalink
RN: Use $ReadOnly in CoreEventTypes
Browse files Browse the repository at this point in the history
Reviewed By: sahrens

Differential Revision: D7082715

fbshipit-source-id: d2f7e280d02bbd8e7dcba2d38b719fa4f82ecb8b
  • Loading branch information
yungsters authored and facebook-github-bot committed Feb 26, 2018
1 parent 16c9e5b commit a817c64
Showing 1 changed file with 52 additions and 47 deletions.
99 changes: 52 additions & 47 deletions Libraries/Types/CoreEventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = $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<T> = {|
+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<Object>;

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

0 comments on commit a817c64

Please sign in to comment.