Fixing misuses of the Text type

Reviewed By: fkgozali

Differential Revision: D7227752

fbshipit-source-id: 3577c86b416a7c04190063243839e98e2a80ec7f
This commit is contained in:
Eli White 2018-03-10 18:29:06 -08:00 committed by Facebook Github Bot
parent cd8128b2ec
commit 3fd82d3c89
1 changed files with 24 additions and 18 deletions

View File

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