import type { ReactNode } from 'react'; import React from 'react'; import type { TextProps as NativeTextProps, StyleProp, TextStyle, } from 'react-native'; import type { TypographyIntent } from '../types'; import { pickAccessibilityProps } from '../utils'; import { StyledBody } from './StyledBody'; import GradientText from '../GradientText'; export interface BodyProps extends NativeTextProps { /** * Text content. */ children: ReactNode; /** * Visual intent color to apply to the text. */ intent?: TypographyIntent; /** * Additional style. */ style?: StyleProp; /** * Testing id of the component. */ testID?: string; /** * The typeface to render the text in: * - `neutral`: The default typeface for the platform. * - `playful`: To visualise a playful content. * * Note: `regular-medium` and `small-medium` variants are only available with the `neutral` typeface. */ typeface?: 'neutral' | 'playful'; /** * Size and weight variant of the text. * Medium variants (`regular-medium`, `small-medium`) are available with the `neutral` typeface only. */ variant?: | 'regular' | 'regular-medium' | 'regular-bold' | 'small' | 'small-medium' | 'small-bold'; /** * Font style to apply to the text. */ fontStyle?: 'normal' | 'italic'; } const Body = ({ children, intent = 'body', allowFontScaling = false, typeface = 'neutral', variant = 'regular', fontStyle = 'normal', style, testID, ...nativeProps }: BodyProps) => { const isAi = intent === 'ai'; const styledText = ( {children} ); if (isAi) { return ( {styledText} ); } return styledText; }; export default Body;