Change layout of SetItem

Moved the date to the description,
and the reps x weight to the right.

Related to #192.
This commit is contained in:
Brandon Presley 2023-11-14 20:44:54 +13:00
parent ddceb91211
commit 859818e5b6
1 changed files with 19 additions and 18 deletions

View File

@ -45,36 +45,37 @@ export default function SetItem({
return LIGHT_RIPPLE; return LIGHT_RIPPLE;
}, [dark, ids, item.id]); }, [dark, ids, item.id]);
const left = useCallback(() => { const image = useCallback(() => {
if (!settings.images || !item.image) return null; if (!settings.images || !item.image) return null;
return ( return (
<Image source={{ uri: item.image }} style={{ height: 75, width: 75 }} /> <Image source={{ uri: item.image }} style={{ height: 75, width: 75 }} />
); );
}, [item.image, settings.images]); }, [item.image, settings.images]);
const right = useCallback(() => {
if (!settings.showDate) return null;
return (
<Text
style={{
alignSelf: "center",
color: dark ? "#909090ff" : "#717171ff",
}}
>
{format(new Date(item.created), settings.date || "P")}
</Text>
);
}, [settings.showDate, item.created, settings.date, dark]);
return ( return (
<List.Item <List.Item
onPress={press} onPress={press}
title={item.name} title={item.name}
description={`${item.reps} x ${item.weight}${item.unit || "kg"}`} description={
settings.showDate ? (
<Text style={{ color: dark ? "#909090ff" : "#717171ff" }}>
{format(new Date(item.created), settings.date || "P")}
</Text>
) : null
}
onLongPress={longPress} onLongPress={longPress}
style={{ backgroundColor: customBg || backgroundColor }} style={{ backgroundColor: customBg || backgroundColor }}
left={left} left={image}
right={right} right={() => (
<Text
style={{
alignSelf: "center",
color: dark ? "#909090ff" : "#717171ff",
}}
>
{`${item.reps} x ${item.weight}${item.unit || "kg"}`}
</Text>
)}
/> />
); );
} }