1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
Zhiyuan Zheng
2021-01-24 02:25:43 +01:00
parent 2a0ad51b24
commit 08f3036753
72 changed files with 978 additions and 440 deletions

View File

@ -1,23 +1,39 @@
import { useNavigation } from '@react-navigation/native'
import { StackNavigationProp } from '@react-navigation/stack'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import React, { useCallback } from 'react'
import { Pressable, StyleSheet, Text } from 'react-native'
import analytics from './analytics'
export interface Props {
tag: Mastodon.Tag
onPress: () => void
hashtag: Mastodon.Tag
onPress?: () => void
origin?: string
}
const ComponentHashtag: React.FC<Props> = ({ tag, onPress }) => {
const ComponentHashtag: React.FC<Props> = ({
hashtag,
onPress: customOnPress,
origin
}) => {
const { theme } = useTheme()
const navigation = useNavigation<
StackNavigationProp<Nav.LocalStackParamList>
>()
const onPress = useCallback(() => {
analytics('search_account_press', { page: origin })
navigation.push('Screen-Shared-Hashtag', { hashtag: hashtag.name })
}, [])
return (
<Pressable
style={[styles.itemDefault, { borderBottomColor: theme.border }]}
onPress={onPress}
onPress={customOnPress || onPress}
>
<Text style={[styles.itemHashtag, { color: theme.primary }]}>
#{tag.name}
#{hashtag.name}
</Text>
</Pressable>
)