Fix starting plan without selecting an item

This commit is contained in:
Brandon Presley 2022-12-03 22:29:45 +13:00
parent 2aa8073856
commit d8eeac66ab
2 changed files with 13 additions and 7 deletions

View File

@ -45,6 +45,7 @@ export default function PlanItem({
const workout = item.workouts.split(',')[0]
let first = await getBestSet(workout)
if (!first) first = {...defaultSet, name: workout}
delete first.id
navigation.navigate('StartPlan', {plan: item, first})
}, [item, navigation])

View File

@ -2,7 +2,7 @@ import {RouteProp, useFocusEffect, useRoute} from '@react-navigation/native'
import {useCallback, useMemo, useRef, useState} from 'react'
import {NativeModules, TextInput, View} from 'react-native'
import {FlatList} from 'react-native-gesture-handler'
import {Button} from 'react-native-paper'
import {Button, ProgressBar} from 'react-native-paper'
import {getBestSet} from './best.service'
import {PADDING} from './constants'
import CountMany from './count-many'
@ -155,12 +155,17 @@ export default function StartPlan() {
<FlatList
data={counts}
renderItem={props => (
<StartPlanItem
{...props}
onUndo={refresh}
onSelect={select}
selected={selected}
/>
<View>
<StartPlanItem
{...props}
onUndo={refresh}
onSelect={select}
selected={selected}
/>
<ProgressBar
progress={(props.item.total || 0) / (props.item.sets || 3)}
/>
</View>
)}
/>
)}