ui.ts
1 // Contains all UI component types 2 3 /* import { ColorScheme } from '@/constants/Colors'; */ 4 /* import { ComponentProps } from 'react'; */ 5 import { Ionicons } from '@expo/vector-icons'; 6 import { TextStyle, ViewStyle } from 'react-native'; 7 import { WebView } from 'react-native-webview'; 8 import Swipeable from 'react-native-gesture-handler/Swipeable'; 9 import { ThemeType, BookmarkStatus } from './'; 10 11 // Define a comprehensive type for all icon names based on Ionicons 12 export type IconName = keyof typeof Ionicons.glyphMap; 13 14 // Make sure Option and AlertOption are consistent 15 export interface Option { 16 text: string; 17 onPress: () => void; 18 icon?: IconName; 19 } 20 21 export interface AlertOption { 22 text: string; 23 onPress: () => void; 24 icon?: IconName; 25 } 26 27 export interface AlertConfig { 28 type: string; 29 title: string; 30 message: string; 31 options: AlertOption[]; 32 } 33 34 export interface ThemeOption { 35 label: string; 36 value: ThemeType; 37 icon: string; 38 } 39 40 export interface ExpandableTextProps { 41 text: string; 42 initialLines?: number; 43 style?: TextStyle; 44 expandedStyle?: TextStyle; 45 } 46 47 export interface LastReadChapterBarProps { 48 lastReadChapter: string | null; 49 onPress: () => void; 50 colors: any; 51 readChapters: string[]; 52 } 53 54 export interface MangaCardProps { 55 title: string; 56 imageUrl: string; 57 onPress: () => void; 58 lastReadChapter: string | null; 59 style?: ViewStyle; 60 mangaId?: string; 61 onBookmarkChange?: (mangaId: string, newStatus: BookmarkStatus | null) => void; 62 } 63 64 export interface NessieAnimationProps { 65 style?: ViewStyle; 66 imageSize?: number; 67 } 68 69 export interface GenreTagProps { 70 genre: string; 71 } 72 73 export interface CustomWebViewProps 74 extends React.ComponentProps<typeof WebView> { 75 allowedHosts?: string[]; 76 currentUrl?: string; 77 } 78 79 export interface SwipeableChapterItemProps { 80 chapter: { 81 number: string; 82 title: string; 83 date: string; 84 }; 85 isRead: boolean; 86 isLastItem: boolean; 87 onPress: () => void; 88 onLongPress: () => void; 89 onUnread: () => void; 90 colors: any; 91 styles: any; 92 currentlyOpenSwipeable: Swipeable | null; 93 setCurrentlyOpenSwipeable: (swipeable: Swipeable | null) => void; 94 } 95 96 export interface CustomAlertProps { 97 visible: boolean; 98 title: string; 99 onClose: () => void; 100 type: 'bookmarks' | 'confirm'; 101 options?: Option[]; 102 message?: string; 103 } 104 105 export interface BottomPopupProps { 106 visible: boolean; 107 title: string; 108 onClose: () => void; 109 options?: Option[]; 110 }