mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Updates
This commit is contained in:
@ -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>
|
||||
)
|
||||
|
Reference in New Issue
Block a user