Fix types

This commit is contained in:
Eric Bailey
2024-11-13 13:29:26 -06:00
parent f131ce5ecb
commit 95720f7744
2 changed files with 10 additions and 6 deletions
+5 -4
View File
@@ -236,12 +236,12 @@ export function Link({
) )
} }
export type InlineLinkProps = React.PropsWithChildren< export type InlineLinkProps = BaseLinkProps &
BaseLinkProps & TextStyleProp & Pick<TextProps, 'selectable' | 'dataSet'> TextStyleProp &
> & Pick<TextProps, 'selectable' | 'dataSet' | 'title' | 'emoji'> &
Pick<ButtonProps, 'label'> & { Pick<ButtonProps, 'label'> & {
disableUnderline?: boolean disableUnderline?: boolean
title?: TextProps['title'] children: React.ReactNode
} }
export function InlineLinkText({ export function InlineLinkText({
@@ -355,6 +355,7 @@ export function WebOnlyInlineLinkText({
{children} {children}
</InlineLinkText> </InlineLinkText>
) : ( ) : (
// @ts-expect-error can't determine type of `children` to infer `emoji`
<Text {...props}>{children}</Text> <Text {...props}>{children}</Text>
) )
} }
+5 -2
View File
@@ -105,6 +105,7 @@ export function RichText({
els.push( els.push(
<ProfileHoverCard key={key} inline did={mention.did}> <ProfileHoverCard key={key} inline did={mention.did}>
<InlineLinkText <InlineLinkText
label={segment.text}
selectable={selectable} selectable={selectable}
to={`/profile/${mention.did}`} to={`/profile/${mention.did}`}
style={interactiveStyles} style={interactiveStyles}
@@ -116,11 +117,13 @@ export function RichText({
</ProfileHoverCard>, </ProfileHoverCard>,
) )
} else if (link && AppBskyRichtextFacet.validateLink(link).success) { } else if (link && AppBskyRichtextFacet.validateLink(link).success) {
const url = toShortUrl(segment.text)
if (disableLinks) { if (disableLinks) {
els.push(toShortUrl(segment.text)) els.push(url)
} else { } else {
els.push( els.push(
<InlineLinkText <InlineLinkText
label={url}
selectable={selectable} selectable={selectable}
key={key} key={key}
to={link.uri} to={link.uri}
@@ -130,7 +133,7 @@ export function RichText({
shareOnLongPress shareOnLongPress
onPress={onLinkPress} onPress={onLinkPress}
emoji> emoji>
{toShortUrl(segment.text)} {url}
</InlineLinkText>, </InlineLinkText>,
) )
} }