Fix types
This commit is contained in:
@@ -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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user