diff options
author | Hailey <me@haileyok.com> | 2024-04-03 18:05:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 18:05:03 -0700 |
commit | 7fb117d213149dfee9d0e79292b267b3cd5bde0e (patch) | |
tree | 74910683224f4d7fd7d660888ef36c13c3fca993 /src | |
parent | a356b1be1a08814766ae9deadd7b8467a35feb0e (diff) | |
download | voidsky-7fb117d213149dfee9d0e79292b267b3cd5bde0e.tar.zst |
Upgrade `UITextView` to latest (#3090)
* uitextview use library w/ fixes bump bump multiple uitextview fixes * bump * update to latest * cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Typography.tsx | 20 | ||||
-rw-r--r-- | src/view/com/util/text/Text.tsx | 9 |
2 files changed, 12 insertions, 17 deletions
diff --git a/src/components/Typography.tsx b/src/components/Typography.tsx index f8b3ad1bd..31dd931c6 100644 --- a/src/components/Typography.tsx +++ b/src/components/Typography.tsx @@ -1,14 +1,9 @@ import React from 'react' -import { - Text as RNText, - StyleProp, - TextStyle, - TextProps as RNTextProps, -} from 'react-native' -import {UITextView} from 'react-native-ui-text-view' +import {StyleProp, TextProps as RNTextProps, TextStyle} from 'react-native' +import {UITextView} from 'react-native-uitextview' -import {useTheme, atoms, web, flatten} from '#/alf' -import {isIOS, isNative} from '#/platform/detection' +import {isNative} from '#/platform/detection' +import {atoms, flatten, useTheme, web} from '#/alf' export type TextProps = RNTextProps & { /** @@ -61,11 +56,8 @@ export function normalizeTextStyles(styles: StyleProp<TextStyle>) { export function Text({style, selectable, ...rest}: TextProps) { const t = useTheme() const s = normalizeTextStyles([atoms.text_sm, t.atoms.text, flatten(style)]) - return selectable && isIOS ? ( - <UITextView style={s} {...rest} /> - ) : ( - <RNText selectable={selectable} style={s} {...rest} /> - ) + + return <UITextView selectable={selectable} uiTextView style={s} {...rest} /> } export function createHeadingElement({level}: {level: number}) { diff --git a/src/view/com/util/text/Text.tsx b/src/view/com/util/text/Text.tsx index 37d665581..2ea9586ee 100644 --- a/src/view/com/util/text/Text.tsx +++ b/src/view/com/util/text/Text.tsx @@ -1,9 +1,10 @@ import React from 'react' import {Text as RNText, TextProps} from 'react-native' -import {s, lh} from 'lib/styles' -import {useTheme, TypographyVariant} from 'lib/ThemeContext' +import {UITextView} from 'react-native-uitextview' + +import {lh, s} from 'lib/styles' +import {TypographyVariant, useTheme} from 'lib/ThemeContext' import {isIOS, isWeb} from 'platform/detection' -import {UITextView} from 'react-native-ui-text-view' export type CustomTextProps = TextProps & { type?: TypographyVariant @@ -36,6 +37,8 @@ export function Text({ return ( <UITextView style={[s.black, typography, lineHeightStyle, style]} + selectable={selectable} + uiTextView {...props}> {children} </UITextView> |