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