From 3fd82d3c89f2d7e5103b024b54250f2ded970d88 Mon Sep 17 00:00:00 2001 From: Eli White Date: Sat, 10 Mar 2018 18:29:06 -0800 Subject: [PATCH] Fixing misuses of the Text type Reviewed By: fkgozali Differential Revision: D7227752 fbshipit-source-id: 3577c86b416a7c04190063243839e98e2a80ec7f --- Libraries/Text/TextProps.js | 42 +++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index 770e7ec0e50113..20eb363765e215 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -13,8 +13,8 @@ import type {Node} from 'react'; -import type {LayoutEvent} from 'CoreEventTypes'; -import type {TextStyleProp} from 'StyleSheet'; +import type {LayoutEvent, PressEvent} from 'CoreEventTypes'; +import type {DangerouslyImpreciseStyleProp} from 'StyleSheet'; type PressRetentionOffset = { top: number, @@ -26,28 +26,34 @@ type PressRetentionOffset = { /** * @see https://facebook.github.io/react-native/docs/text.html#reference */ -export type TextProps = {| - accessible?: boolean, - allowFontScaling?: boolean, +export type TextProps = $ReadOnly<{ + accessible?: ?boolean, + allowFontScaling?: ?boolean, children?: Node, ellipsizeMode?: 'clip' | 'head' | 'middle' | 'tail', nativeID?: string, - numberOfLines?: number, - onLayout?: ?(event: LayoutEvent) => void, - onLongPress?: ?() => void, - onPress?: ?() => void, - pressRetentionOffset?: PressRetentionOffset, - selectable?: boolean, - style?: TextStyleProp, + numberOfLines?: ?number, + onLayout?: ?(event: LayoutEvent) => mixed, + onLongPress?: ?(event: PressEvent) => mixed, + onPress?: ?(event: PressEvent) => mixed, + onResponderGrant?: ?Function, + onResponderMove?: ?Function, + onResponderRelease?: ?Function, + onResponderTerminate?: ?Function, + onResponderTerminationRequest?: ?Function, + onStartShouldSetResponder?: ?Function, + pressRetentionOffset?: ?PressRetentionOffset, + selectable?: ?boolean, + style?: ?DangerouslyImpreciseStyleProp, testID?: string, // Android Only - disabled?: boolean, - selectionColor?: string, + disabled?: ?boolean, + selectionColor?: ?string, textBreakStrategy?: 'balanced' | 'highQuality' | 'simple', // iOS Only - adjustsFontSizeToFit?: boolean, - minimumFontScale?: number, - suppressHighlighting?: boolean, -|}; + adjustsFontSizeToFit?: ?boolean, + minimumFontScale?: ?number, + suppressHighlighting?: ?boolean, +}>;