import React, {useCallback} from 'react' import {StyleProp, StyleSheet, TouchableOpacity, ViewStyle} from 'react-native' import {RepostIcon} from 'lib/icons' import {s, colors} from 'lib/styles' import {useTheme} from 'lib/ThemeContext' import {Text} from '../text/Text' import {pluralize} from 'lib/strings/helpers' import {HITSLOP_10, HITSLOP_20} from 'lib/constants' import {useModalControls} from '#/state/modals' interface Props { isReposted: boolean repostCount?: number big?: boolean onRepost: () => void onQuote: () => void } export const RepostButton = ({ isReposted, repostCount, big, onRepost, onQuote, }: Props) => { const theme = useTheme() const {openModal} = useModalControls() const defaultControlColor = React.useMemo( () => ({ color: theme.palette.default.postCtrl, }), [theme], ) const onPressToggleRepostWrapper = useCallback(() => { openModal({ name: 'repost', onRepost: onRepost, onQuote: onQuote, isReposted, }) }, [onRepost, onQuote, isReposted, openModal]) return ( ) : defaultControlColor } strokeWidth={2.4} size={big ? 24 : 20} /> {typeof repostCount !== 'undefined' ? ( {repostCount} ) : undefined} ) } const styles = StyleSheet.create({ control: { flexDirection: 'row', alignItems: 'center', }, controlPad: { padding: 5, }, reposted: { color: colors.green3, }, repostCount: { color: 'currentColor', }, })