import { useNavigation } from '@react-navigation/native' import { StackNavigationProp } from '@react-navigation/stack' import { TabLocalStackParamList } from '@utils/navigation/navigators' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React, { PropsWithChildren, useState } from 'react' import { Dimensions, Pressable, View } from 'react-native' import Sparkline from './Sparkline' import CustomText from './Text' export interface Props { hashtag: Mastodon.Tag onPress?: () => void } const ComponentHashtag: React.FC = ({ hashtag, onPress: customOnPress, children }) => { const { colors } = useTheme() const navigation = useNavigation>() const onPress = () => { navigation.push('Tab-Shared-Hashtag', { tag_name: hashtag.name }) } const padding = StyleConstants.Spacing.Global.PagePadding const width = Dimensions.get('window').width / 4 const [height, setHeight] = useState(0) return ( #{hashtag.name} {hashtag.history?.length ? ( setHeight(height)} > parseInt(h.uses)).reverse()} width={width} height={height} margin={children ? StyleConstants.Spacing.S : undefined} /> {children} ) : null} ) } export default ComponentHashtag