import * as React from 'react';
import { View } from 'react-native';
import { useColors } from '../../hook';
import { usePaletteContext } from '../../theme';
import { IconButton } from '../../ui/Button';
import { PressableHighlight } from '../../ui/Pressable';
import { SingleLineText } from '../../ui/Text';
import { Avatar } from '../Avatar';
import type { GroupParticipantListItemProps } from './types';
/**
* Group Participant List Item Component.
*/
export function GroupParticipantListItem(props: GroupParticipantListItemProps) {
const { data, onClicked, onLongPressed, onCheckClicked } = props;
const { colors } = usePaletteContext();
const { getColor } = useColors({
t2: {
light: colors.neutral[5],
dark: colors.neutral[6],
},
no_checked: {
light: colors.neutral[7],
dark: colors.neutral[4],
},
checked: {
light: colors.primary[5],
dark: colors.primary[6],
},
});
const getCheckedButton = (disable?: boolean, checked?: boolean) => {
const name = (checked?: boolean) => {
return checked !== false ? 'checked_rectangle' : 'unchecked_rectangle';
};
const color = (disable?: boolean) => {
return disable !== true ? getColor('enable') : getColor('disable2');
};
if (checked === undefined) {
return null;
}
return (
{
if (disable !== true) {
onCheckClicked?.(data);
}
}}
/>
);
};
return (
{
if (data.checked !== undefined) {
if (data.disable !== true) {
onCheckClicked?.(data);
}
} else {
onClicked?.(data);
}
}}
onLongPress={() => {
onLongPressed?.(data);
}}
>
{getCheckedButton(data.disable, data.checked)}
{data.memberName ?? data.memberId}
);
}
export const GroupParticipantListItemMemo = React.memo(
GroupParticipantListItem
);