import { forwardRef } from 'react'; import { Pressable, View, StyleSheet } from 'react-native'; import * as Haptics from 'expo-haptics'; import { useTheme } from '~/features/theme/ThemeProvider'; import Icon from '~/components/atoms/Icon'; import NotificationBadge from '~/components/atoms/NotificationBadge'; import { useUnuploadedCount } from '~/features/storage/hooks/useUnuploadedCount'; import { useInitializeUploadStatus } from '~/features/storage/store/uploadStatusStore'; export const HeaderButton = forwardRef void }>( ({ onPress }, ref) => { const { tw } = useTheme(); // Initialize upload status store useInitializeUploadStatus(); // Get count of unuploaded audio files const unuploadedCount = useUnuploadedCount(); const handlePress = async () => { try { await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); } catch (error) { console.debug('Haptic feedback error:', error); } onPress?.(); }; return ( {({ pressed }) => ( )} {unuploadedCount > 0 && ( )} ); } ); const styles = StyleSheet.create({ container: { position: 'relative', marginRight: 16, }, badge: { position: 'absolute', top: -2, right: -2, zIndex: 10, }, });