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>
)

View File

@@ -32,11 +32,6 @@ const fireMutation = async ({
instance: 'local',
endpoint: `statuses/${id}/${prevState ? 'un' : ''}${type}`
})
res = await client({
method: 'post',
instance: 'local',
endpoint: `statuses/${id}/${prevState ? 'un' : ''}${type}`
})
if (!res.body[stateKey] === prevState) {
return Promise.resolve(res.body)

View File

@@ -51,6 +51,9 @@ const Timeline: React.FC<Props> = ({
fetchMore
} = useInfiniteQuery(queryKey, timelineFetch)
const flattenData = data ? data.flatMap(d => [...d?.toots]) : []
// if (page==='Toot'){
// console.log(data)
// }
let content
if (!isSuccess) {

View File

@@ -159,8 +159,12 @@ export const timelineFetch = async (
endpoint: `statuses/${toot}/context`
})
return Promise.resolve({
toots: [...context.ancestors, current, ...context.descendants],
pointer: context.ancestors.length
toots: [
...context.body.ancestors,
current.body,
...context.body.descendants
],
pointer: context.body.ancestors.length
})
default: