ThemedText
TheThemedText component is a wrapper around React Native’s Text component that automatically applies theme-aware colors and provides predefined text styles.
Import
Props
The component extends all standard React NativeTextProps and adds the following:
Custom color to use in light mode. If not provided, uses the theme’s default text color.
Custom color to use in dark mode. If not provided, uses the theme’s default text color.
Predefined text style to apply:
default: 16px font size, 24px line heighttitle: 32px bold font, 32px line heightdefaultSemiBold: 16px semi-bold font, 24px line heightsubtitle: 20px bold fontlink: 16px font, 30px line height, blue color (#0a7ea4)
Usage
Basic Usage
With Type Variants
Custom Theme Colors
With Additional Styles
How Theme Colors Work
The component uses theuseThemeColor hook to automatically select the appropriate color based on the current theme:
- If
lightColorordarkColorare provided, those are used for the respective themes - Otherwise, it falls back to the theme’s default
textcolor - The color automatically updates when the user switches between light and dark mode
Source Code
Location:src/components/ThemedText.tsx:11
