Import
Basic Usage
Props
Content Props
React.Node
The text content to display.
Styling Props
TextStyle
Text styling including font properties, color, and text decoration. Supports all text-specific style properties.
Display Props
number
Used to truncate the text with an ellipsis after computing the text layout, including line wrapping, such that the total number of lines does not exceed this number.
'head' | 'middle' | 'tail' | 'clip'
default:"'tail'"
When
numberOfLines is set, this prop defines how text will be truncated.head- The line is displayed so that the end fits in the container and the missing text at the beginning is indicated by an ellipsis. e.g., “…wxyz”middle- The line is displayed so that the beginning and end fit in the container and the missing text in the middle is indicated by an ellipsis. “ab…yz”tail- The line is displayed so that the beginning fits in the container and the missing text at the end is indicated by an ellipsis. e.g., “abcd…”clip- Lines are not drawn past the edge of the text container (iOS only)
Font Props
boolean
default:"true"
Whether fonts should scale to respect Text Size accessibility settings.
number
Specifies largest possible scale a font can reach when
allowFontScaling is enabled.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
Interaction Props
boolean
Lets the user select text, to use the native copy and paste functionality.
(event: GestureResponderEvent) => void
This function is called on press. Text intrinsically supports press handling with a default highlight state.
(event: GestureResponderEvent) => void
This function is called on long press.
Insets
Defines how far your touch may move off of the button, before deactivating the button.
boolean
Specifies the disabled state of the text view for testing purposes.
Identification Props
string
Used to reference react managed views from native code.
string
Used to locate this view from native code.
string
Used to locate this view in end-to-end tests.
Event Handlers
(event: LayoutEvent) => void
Invoked on mount and layout changes with
{nativeEvent: { layout: {x, y, width, height}}}.(event: TextLayoutEvent) => void
Called when the text layout changes.
Platform-Specific Props
- iOS
- Android
boolean
Specifies whether font should be scaled down automatically to fit given style constraints.
boolean
When true, no visual change is made when text is pressed down. By default, a gray oval highlights the text on press down.
'none' | 'standard' | 'hangul-word' | 'push-out'
Set line break strategy on iOS.
string
The Dynamic Type scale ramp to apply to this element on iOS. Options include: ‘caption2’, ‘caption1’, ‘footnote’, ‘subheadline’, ‘callout’, ‘body’, ‘headline’, ‘title3’, ‘title2’, ‘title1’, ‘largeTitle’.