Overview
ThemedText is a wrapper around React Native’s Text component that provides automatic theme-aware text colors and predefined typography styles. It supports multiple text types with different sizes, weights, and styling.
Import
Props
ThemedText extends all standard React Native TextProps and adds the following props:
The typography style to apply:
default: Regular text (16px, line height 24)title: Large bold text (32px, bold, line height 32)defaultSemiBold: Semi-bold text (16px, weight 600, line height 24)subtitle: Medium bold text (20px, bold)link: Link-styled text (16px, line height 30, color #0a7ea4)
Custom text color to use in light mode. If not provided, uses the default theme text color.
Custom text color to use in dark mode. If not provided, uses the default theme text color.
Standard React Native style prop. Applied after theme and type styles.
Usage Examples
Basic Usage with Types
Inline Text Styling
Link Text
Platform-Specific Content
Custom Theme Colors
Typography Styles
The component provides the following predefined typography styles:| Type | Font Size | Line Height | Font Weight | Color |
|---|---|---|---|---|
default | 16px | 24 | normal | theme text color |
defaultSemiBold | 16px | 24 | 600 | theme text color |
title | 32px | 32 | bold | theme text color |
subtitle | 20px | - | bold | theme text color |
link | 16px | 30 | normal | #0a7ea4 |
Implementation Details
The component:- Uses the
useThemeColorhook to determine text color based on theme - Applies the selected typography style from predefined StyleSheet
- Merges theme color, type styles, and custom styles in order
- Passes all other props to the underlying Text component