import React from "react"; import { Text, TextProps } from "react-native"; import { Color, Position, Size, toTextColor, toTextPosition, toTextSize, toTextWeight, Weight, } from "../Constants"; export interface ExtendedTextProps extends TextProps { position?: Position; color?: Color; size?: Size; weight?: Weight; isLink?: boolean; } export default React.forwardRef( ( { position, color, size, weight, isLink, className, children, ...props }, ref ): React.ReactElement => { const buildClassName = () => { const textSize = toTextSize(size ?? "lg"); const textColor = toTextColor(color ?? "black"); const textWeight = toTextWeight(weight ?? "normal"); const textPosition = toTextPosition(position ?? "left"); return ( textSize + " " + textPosition + " " + textColor + " " + textWeight + " " + (isLink ? "text-orange-500 underline" : "") + " " + className ); }; return ( {children} ); } );