From f91d529f39db8d4181bc230da4a8dafa8f439c30 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 2 Nov 2022 13:02:02 +1300 Subject: [PATCH] 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. --- PlanItem.tsx | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/PlanItem.tsx b/PlanItem.tsx index aeaa826..33a87e7 100644 --- a/PlanItem.tsx +++ b/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 ( - <> - ( - setShow(false)}> - - - - - )} - /> - + ( + setShow(false)}> + + + + + + )} + /> ) }