2018-01-06 10:06:22 +03:00
|
|
|
/**
|
2018-09-12 01:27:47 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-01-06 10:06:22 +03:00
|
|
|
*
|
2018-02-17 05:24:55 +03:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-01-06 10:06:22 +03:00
|
|
|
*
|
2018-11-22 01:24:28 +03:00
|
|
|
* @flow strict-local
|
2018-01-06 10:06:22 +03:00
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2019-05-08 18:44:25 +03:00
|
|
|
import type {
|
|
|
|
LayoutEvent,
|
|
|
|
PressEvent,
|
|
|
|
TextLayoutEvent,
|
|
|
|
} from '../Types/CoreEventTypes';
|
|
|
|
import type {Node} from 'react';
|
|
|
|
import type {TextStyleProp} from '../StyleSheet/StyleSheet';
|
|
|
|
import type {
|
|
|
|
AccessibilityRole,
|
|
|
|
AccessibilityStates,
|
|
|
|
} from '../Components/View/ViewAccessibility';
|
2018-01-06 10:06:22 +03:00
|
|
|
|
2018-05-09 10:47:54 +03:00
|
|
|
export type PressRetentionOffset = $ReadOnly<{|
|
2018-01-06 10:06:22 +03:00
|
|
|
top: number,
|
|
|
|
left: number,
|
|
|
|
bottom: number,
|
|
|
|
right: number,
|
2018-05-09 10:47:54 +03:00
|
|
|
|}>;
|
2018-01-06 10:06:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see https://facebook.github.io/react-native/docs/text.html#reference
|
|
|
|
*/
|
2019-02-06 02:23:14 +03:00
|
|
|
export type TextProps = $ReadOnly<{|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* Indicates whether the view is an accessibility element.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#accessible
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
accessible?: ?boolean,
|
2019-02-06 02:23:14 +03:00
|
|
|
accessibilityHint?: ?Stringish,
|
|
|
|
accessibilityLabel?: ?Stringish,
|
2018-08-24 20:38:42 +03:00
|
|
|
accessibilityRole?: ?AccessibilityRole,
|
|
|
|
accessibilityStates?: ?AccessibilityStates,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether font should be scaled down automatically.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#adjustsfontsizetofit
|
|
|
|
*/
|
|
|
|
adjustsFontSizeToFit?: ?boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether fonts should scale to respect Text Size accessibility settings.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#allowfontscaling
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
allowFontScaling?: ?boolean,
|
2019-05-08 18:44:25 +03:00
|
|
|
children?: ?Node,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When `numberOfLines` is set, this prop defines how text will be
|
|
|
|
* truncated.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#ellipsizemode
|
|
|
|
*/
|
2018-08-24 20:38:42 +03:00
|
|
|
ellipsizeMode?: ?('clip' | 'head' | 'middle' | 'tail'),
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies largest possible scale a font can reach when `allowFontScaling` is enabled.
|
|
|
|
* Possible values:
|
|
|
|
* `null/undefined` (default): inherit from the parent node or the global default (0)
|
|
|
|
* `0`: no max, ignore parent/global default
|
|
|
|
* `>= 1`: sets the maxFontSizeMultiplier of this node to this value
|
|
|
|
*/
|
|
|
|
maxFontSizeMultiplier?: ?number,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to locate this view from native code.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#nativeid
|
|
|
|
*/
|
2018-08-24 20:38:42 +03:00
|
|
|
nativeID?: ?string,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to truncate the text with an ellipsis.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#numberoflines
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
numberOfLines?: ?number,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked on mount and layout changes.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#onlayout
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
onLayout?: ?(event: LayoutEvent) => mixed,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is called on long press.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#onlongpress
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
onLongPress?: ?(event: PressEvent) => mixed,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is called on press.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#onpress
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
onPress?: ?(event: PressEvent) => mixed,
|
2018-11-22 01:24:28 +03:00
|
|
|
onResponderGrant?: ?(event: PressEvent, dispatchID: string) => void,
|
|
|
|
onResponderMove?: ?(event: PressEvent) => void,
|
|
|
|
onResponderRelease?: ?(event: PressEvent) => void,
|
|
|
|
onResponderTerminate?: ?(event: PressEvent) => void,
|
|
|
|
onResponderTerminationRequest?: ?() => boolean,
|
|
|
|
onStartShouldSetResponder?: ?() => boolean,
|
2019-02-06 02:23:14 +03:00
|
|
|
onMoveShouldSetResponder?: ?() => boolean,
|
2018-08-30 19:26:21 +03:00
|
|
|
onTextLayout?: ?(event: TextLayoutEvent) => mixed,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines how far your touch may move off of the button, before
|
|
|
|
* deactivating the button.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
pressRetentionOffset?: ?PressRetentionOffset,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Lets the user select text.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#selectable
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
selectable?: ?boolean,
|
2019-01-03 14:40:41 +03:00
|
|
|
style?: ?TextStyleProp,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to locate this view in end-to-end tests.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#testid
|
|
|
|
*/
|
2018-08-24 20:38:42 +03:00
|
|
|
testID?: ?string,
|
2018-01-06 10:06:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* Android Only
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies the disabled state of the text view for testing purposes.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#disabled
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
disabled?: ?boolean,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The highlight color of the text.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#selectioncolor
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
selectionColor?: ?string,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
2019-03-26 22:25:33 +03:00
|
|
|
dataDetectorType?: ?('phoneNumber' | 'link' | 'email' | 'none' | 'all'),
|
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* Set text break strategy on Android.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#textbreakstrategy
|
|
|
|
*/
|
2018-08-24 20:38:42 +03:00
|
|
|
textBreakStrategy?: ?('balanced' | 'highQuality' | 'simple'),
|
2018-01-06 10:06:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* iOS Only
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
adjustsFontSizeToFit?: ?boolean,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Smallest possible scale a font can reach.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#minimumfontscale
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
minimumFontScale?: ?number,
|
2018-09-29 09:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When `true`, no visual change is made when text is pressed down.
|
|
|
|
*
|
|
|
|
* See https://facebook.github.io/react-native/docs/text.html#supperhighlighting
|
|
|
|
*/
|
2018-03-11 05:29:06 +03:00
|
|
|
suppressHighlighting?: ?boolean,
|
2019-02-06 02:23:14 +03:00
|
|
|
|}>;
|