import React from 'react'; import { Pressable, Text, View } from 'react-native'; import FastImage from 'react-native-fast-image'; import Check from '../Check'; import styles, { ROW_HEIGHT } from './styles'; import { themes } from '../../lib/constants'; import { isIOS } from '../../lib/methods/helpers'; import { useTheme } from '../../theme'; export { ROW_HEIGHT }; export interface IServerItem { item: { id: string; iconURL: string; name: string; useRealName?: boolean; }; onPress(): void; onLongPress?(): void; hasCheck?: boolean; } const defaultLogo = require('../../static/images/logo.png'); const ServerItem = React.memo(({ item, onPress, onLongPress, hasCheck }: IServerItem) => { const { theme } = useTheme(); return ( onLongPress?.()} testID={`rooms-list-header-server-${item.id}`} android_ripple={{ color: themes[theme].bannerBackground }} style={({ pressed }: { pressed: boolean }) => ({ backgroundColor: isIOS && pressed ? themes[theme].bannerBackground : themes[theme].backgroundColor })} > {item.iconURL ? ( console.log('err_loading_server_icon')} /> ) : ( )} {item.name || item.id} {item.id} {hasCheck ? : null} ); }); export default ServerItem;