diff options
Diffstat (limited to 'src/view/com/util/text/Text.tsx')
-rw-r--r-- | src/view/com/util/text/Text.tsx | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/view/com/util/text/Text.tsx b/src/view/com/util/text/Text.tsx index dbf5e2e13..f05274f44 100644 --- a/src/view/com/util/text/Text.tsx +++ b/src/view/com/util/text/Text.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {StyleSheet, Text as RNText, TextProps} from 'react-native' +import {StyleSheet, TextProps} from 'react-native' import {UITextView} from 'react-native-uitextview' import {lh, s} from '#/lib/styles' @@ -9,10 +9,9 @@ import {isIOS, isWeb} from '#/platform/detection' import {applyFonts, useAlf} from '#/alf' import { childHasEmoji, - childIsString, renderChildrenWithEmoji, StringChild, -} from '#/components/Typography' +} from '#/alf/typography' import {IS_DEV} from '#/env' export type CustomTextProps = Omit<TextProps, 'children'> & { @@ -32,7 +31,11 @@ export type CustomTextProps = Omit<TextProps, 'children'> & { } ) -export function Text({ +export {Text_DEPRECATED as Text} +/** + * @deprecated use Text from Typography instead. + */ +function Text_DEPRECATED({ type = 'md', children, emoji, @@ -52,10 +55,6 @@ export function Text({ `Text: emoji detected but emoji not enabled: "${children}"\n\nPlease add <Text emoji />'`, ) } - - if (emoji && !childIsString(children)) { - logger.error('Text: when <Text emoji />, children can only be strings.') - } } const textProps = React.useMemo(() => { @@ -103,19 +102,9 @@ export function Text({ type, ]) - if (selectable && isIOS) { - return ( - <UITextView {...textProps}> - {isIOS && emoji - ? renderChildrenWithEmoji(children, textProps) - : children} - </UITextView> - ) - } - return ( - <RNText {...textProps}> - {isIOS && emoji ? renderChildrenWithEmoji(children, textProps) : children} - </RNText> + <UITextView {...textProps}> + {renderChildrenWithEmoji(children, textProps, emoji ?? false)} + </UITextView> ) } |