import * as React from 'react'; import type { BaseTheme, ColorProps, OpacityProps, SpacingProps, SpacingShorthandProps, TextShadowProps, TypographyProps, VariantProps, VisibleProps, } from '@shopify/restyle'; import { createText } from '@shopify/restyle'; import type { Text as RNText } from 'react-native'; import { Animated } from 'react-native'; import type { Theme } from './../../theme/theme'; const $Text = createText(); type BaseTextProps = ColorProps & OpacityProps & VisibleProps & TypographyProps & SpacingProps & TextShadowProps & VariantProps; interface IProps { bold?: boolean; } export type TextProps = BaseTextProps & SpacingShorthandProps; /** * `Text` helps us create hierarchies, organize information, and guide our users through pages * @param bold is an optional `boolean` to set a font weight * * @example * ```tsx The wizard quickly jinxed the gnomes before they vaporized * ``` * * @see https://zeroheight.com/502cb86ad/p/05f910-typography */ export const Text = ({ children, bold = false, ...props }: IProps & React.ComponentProps & { children?: React.ReactNode; } & TextProps) => { if (bold) { return ( <$Text {...props} fontFamily="CaustenRound-Bold"> {children} ); } return <$Text {...props}>{children}; }; export const AnimatedText = Animated.createAnimatedComponent($Text);