Add copy feature for plans
Long tap an existing plan, then press copy. This will bring up a new plan to add with all the same workouts/days as the one you have copied.
This commit is contained in:
parent
ffbefe7a4f
commit
f91d529f39
36
PlanItem.tsx
36
PlanItem.tsx
|
@ -78,21 +78,27 @@ export default function PlanItem({
|
|||
[item.workouts],
|
||||
)
|
||||
|
||||
const copy = useCallback(() => {
|
||||
const plan: Plan = {...item}
|
||||
delete plan.id
|
||||
setShow(false)
|
||||
navigation.navigate('EditPlan', {plan})
|
||||
}, [navigation, item])
|
||||
|
||||
return (
|
||||
<>
|
||||
<List.Item
|
||||
onPress={start}
|
||||
title={title}
|
||||
description={description}
|
||||
onLongPress={longPress}
|
||||
right={() => (
|
||||
<Menu anchor={anchor} visible={show} onDismiss={() => setShow(false)}>
|
||||
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
||||
<Divider />
|
||||
<Menu.Item icon="delete" onPress={remove} title="Delete" />
|
||||
</Menu>
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
<List.Item
|
||||
onPress={start}
|
||||
title={title}
|
||||
description={description}
|
||||
onLongPress={longPress}
|
||||
right={() => (
|
||||
<Menu anchor={anchor} visible={show} onDismiss={() => setShow(false)}>
|
||||
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
||||
<Menu.Item icon="content-copy" onPress={copy} title="Copy" />
|
||||
<Divider />
|
||||
<Menu.Item icon="delete" onPress={remove} title="Delete" />
|
||||
</Menu>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user