import { StyleConstants } from '@utils/styles/constants' import { useEffect, useState } from 'react' import { AccessibilityInfo, Text, TextProps, TextStyle } from 'react-native' type Props = | { style?: Omit fontStyle?: undefined fontSize?: 'S' | 'M' | 'L' lineHeight?: 'S' | 'M' | 'L' fontWeight?: 'Normal' | 'Bold' } | { style?: Omit fontStyle: 'S' | 'M' | 'L' fontSize?: undefined lineHeight?: undefined fontWeight?: 'Normal' | 'Bold' } const CustomText: React.FC = ({ children, style, fontStyle, fontSize, fontWeight = 'Normal', lineHeight, ...rest }) => { const [isBoldText, setIsBoldText] = useState(false) useEffect(() => { const boldTextChangedSubscription = AccessibilityInfo.addEventListener( 'boldTextChanged', boldTextChanged => { setIsBoldText(boldTextChanged) } ) AccessibilityInfo.isBoldTextEnabled().then(boldTextEnabled => { setIsBoldText(boldTextEnabled) }) return () => { boldTextChangedSubscription.remove() } }, []) enum BoldMapping { 'Normal' = '600', 'Bold' = '800' } return ( {children} ) } export default CustomText