1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix details

This commit is contained in:
Zhiyuan Zheng
2020-11-05 21:47:50 +01:00
parent c825895b92
commit 04b7b0a7b9
7 changed files with 85 additions and 101 deletions

View File

@ -4,7 +4,7 @@ import HTMLView, { HTMLViewNode } from 'react-native-htmlview'
import { useNavigation } from '@react-navigation/native'
import Emojis from 'src/components/Status/Emojis'
// Prevent going to the same hashtag multiple times
const renderNode = ({
node,
index,
@ -29,7 +29,7 @@ const renderNode = ({
style={styles.a}
onPress={() => {
const tag = href.split(new RegExp(/\/tag\/(.*)|\/tags\/(.*)/))
navigation.navigate('Hashtag', {
navigation.push('Hashtag', {
hashtag: tag[1] || tag[2]
})
}}
@ -38,7 +38,7 @@ const renderNode = ({
{node.children[1]?.children[0].data}
</Text>
)
} else if (classes.includes('mention')) {
} else if (classes.includes('mention') && mentions) {
return (
<Text
key={index}
@ -48,7 +48,7 @@ const renderNode = ({
const usernameIndex = mentions.findIndex(
m => m.username === username[1]
)
navigation.navigate('Account', {
navigation.push('Account', {
id: mentions[usernameIndex].id
})
}}
@ -106,8 +106,12 @@ const ParseContent: React.FC<Props> = ({
renderNode({ node, index, navigation, mentions, showFullLink })
}
TextComponent={({ children }) =>
emojis ? (
<Emojis content={children} emojis={emojis} dimension={emojiSize} />
emojis && children ? (
<Emojis
content={children.toString()}
emojis={emojis}
dimension={emojiSize}
/>
) : (
<Text>{children}</Text>
)