Skip to content

Commit 3fd82d3

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Fixing misuses of the Text type
Reviewed By: fkgozali Differential Revision: D7227752 fbshipit-source-id: 3577c86b416a7c04190063243839e98e2a80ec7f
1 parent cd8128b commit 3fd82d3

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

Libraries/Text/TextProps.js

+24-18
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
import type {Node} from 'react';
1515

16-
import type {LayoutEvent} from 'CoreEventTypes';
17-
import type {TextStyleProp} from 'StyleSheet';
16+
import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
17+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
1818

1919
type PressRetentionOffset = {
2020
top: number,
@@ -26,28 +26,34 @@ type PressRetentionOffset = {
2626
/**
2727
* @see https://facebook.github.io/react-native/docs/text.html#reference
2828
*/
29-
export type TextProps = {|
30-
accessible?: boolean,
31-
allowFontScaling?: boolean,
29+
export type TextProps = $ReadOnly<{
30+
accessible?: ?boolean,
31+
allowFontScaling?: ?boolean,
3232
children?: Node,
3333
ellipsizeMode?: 'clip' | 'head' | 'middle' | 'tail',
3434
nativeID?: string,
35-
numberOfLines?: number,
36-
onLayout?: ?(event: LayoutEvent) => void,
37-
onLongPress?: ?() => void,
38-
onPress?: ?() => void,
39-
pressRetentionOffset?: PressRetentionOffset,
40-
selectable?: boolean,
41-
style?: TextStyleProp,
35+
numberOfLines?: ?number,
36+
onLayout?: ?(event: LayoutEvent) => mixed,
37+
onLongPress?: ?(event: PressEvent) => mixed,
38+
onPress?: ?(event: PressEvent) => mixed,
39+
onResponderGrant?: ?Function,
40+
onResponderMove?: ?Function,
41+
onResponderRelease?: ?Function,
42+
onResponderTerminate?: ?Function,
43+
onResponderTerminationRequest?: ?Function,
44+
onStartShouldSetResponder?: ?Function,
45+
pressRetentionOffset?: ?PressRetentionOffset,
46+
selectable?: ?boolean,
47+
style?: ?DangerouslyImpreciseStyleProp,
4248
testID?: string,
4349

4450
// Android Only
45-
disabled?: boolean,
46-
selectionColor?: string,
51+
disabled?: ?boolean,
52+
selectionColor?: ?string,
4753
textBreakStrategy?: 'balanced' | 'highQuality' | 'simple',
4854

4955
// iOS Only
50-
adjustsFontSizeToFit?: boolean,
51-
minimumFontScale?: number,
52-
suppressHighlighting?: boolean,
53-
|};
56+
adjustsFontSizeToFit?: ?boolean,
57+
minimumFontScale?: ?number,
58+
suppressHighlighting?: ?boolean,
59+
}>;

0 commit comments

Comments
 (0)