1
0
mirror of https://github.com/tooot-app/app synced 2025-05-10 06:49:03 +02:00
Zhiyuan Zheng 2020-12-29 12:33:22 +01:00
parent 2ce842e15f
commit 8e93492ae3
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
4 changed files with 14 additions and 18 deletions

View File

@ -54,21 +54,19 @@ const renderNode = ({
</Text> </Text>
) )
} else if (classes.includes('mention') && mentions) { } else if (classes.includes('mention') && mentions) {
const accountIndex = mentions.findIndex(mention => mention.url === href)
return ( return (
<Text <Text
key={index} key={index}
style={{ style={{
color: theme.blue, color: accountIndex !== -1 ? theme.blue : undefined,
...StyleConstants.FontStyle[size] ...StyleConstants.FontStyle[size]
}} }}
onPress={() => { onPress={() => {
const username = href.split(new RegExp(/@(.*)/)) accountIndex !== -1 &&
const usernameIndex = mentions.findIndex( navigation.push('Screen-Shared-Account', {
m => m.username === username[1] account: mentions[accountIndex]
) })
navigation.push('Screen-Shared-Account', {
account: mentions[usernameIndex]
})
}} }}
> >
{node.children[0].data} {node.children[0].data}
@ -97,13 +95,11 @@ const renderNode = ({
} }
> >
{!shouldBeTag ? ( {!shouldBeTag ? (
<> <Feather
<Feather name='external-link'
name='external-link' size={StyleConstants.Font.Size[size]}
size={StyleConstants.Font.Size[size]} color={theme.blue}
color={theme.blue} />
/>{' '}
</>
) : null} ) : null}
{content || (showFullLink ? href : domain[1])} {content || (showFullLink ? href : domain[1])}
</Text> </Text>

View File

@ -3,7 +3,7 @@ import { Image, StyleSheet, Text } from 'react-native'
import { useTheme } from '@utils/styles/ThemeManager' import { useTheme } from '@utils/styles/ThemeManager'
import { StyleConstants } from '@utils/styles/constants' import { StyleConstants } from '@utils/styles/constants'
const regexEmoji = new RegExp(/(:[a-z0-9_]+:)/) const regexEmoji = new RegExp(/(:[A-Za-z0-9_]+:)/)
export interface Props { export interface Props {
content: string content: string

View File

@ -57,7 +57,7 @@ const fireMutation = async ({
export interface Props { export interface Props {
queryKey?: QueryKey.Timeline queryKey?: QueryKey.Timeline
account: Mastodon.Account account: Pick<Mastodon.Account, 'id' | 'username' | 'acct' | 'url'>
setBottomSheetVisible: React.Dispatch<React.SetStateAction<boolean>> setBottomSheetVisible: React.Dispatch<React.SetStateAction<boolean>>
} }

View File

@ -20,7 +20,7 @@ import layoutAnimation from '@root/utils/styles/layoutAnimation'
export interface Props { export interface Props {
route: { route: {
params: { params: {
account: Mastodon.Account account: Pick<Mastodon.Account, 'id' | 'username' | 'acct' | 'url'>
} }
} }
navigation: any navigation: any