From 978fe983939d53a1471dc8145ec5eac700bd4a84 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sat, 9 Jul 2022 17:10:28 +1200 Subject: [PATCH] Make EditPlan scroll --- EditPlan.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/EditPlan.tsx b/EditPlan.tsx index b475edb..bbd906c 100644 --- a/EditPlan.tsx +++ b/EditPlan.tsx @@ -1,5 +1,5 @@ import React, {useContext, useEffect, useState} from 'react'; -import {StyleSheet, Text, View} from 'react-native'; +import {ScrollView, StyleSheet, Text, View} from 'react-native'; import {Button, Dialog, Portal, Switch} from 'react-native-paper'; import {DatabaseContext} from './App'; import {Plan} from './plan'; @@ -27,8 +27,8 @@ export default function EditPlan({ if (!namesResult.rows.length) return setNames([]); setNames(namesResult.rows.raw().map(({name}) => name)); if (!plan) return; - setDays(plan.days.split(',')); - setWorkouts(plan.workouts.split(',')); + if (plan.days) setDays(plan.days.split(',')); + if (plan.workouts) setWorkouts(plan.workouts.split(',')); }; refresh(); }, [plan, db]); @@ -71,10 +71,12 @@ export default function EditPlan({ setPlan(undefined)}> - {plan ? `Edit "${days.slice(0, 2).join(', ')}"` : 'Add a plan'} + {plan?.days ? `Edit "${days.slice(0, 2).join(', ')}"` : 'Add a plan'} - - + + Days {DAYS.map(day => ( @@ -88,9 +90,7 @@ export default function EditPlan({ ))} - - - Workouts + Workouts {names.length === 0 && ( No sets found. Try going to the home page and adding some @@ -110,8 +110,8 @@ export default function EditPlan({ ))} - - + +