Fix starting plan without selecting an item
This commit is contained in:
parent
2aa8073856
commit
d8eeac66ab
|
@ -45,6 +45,7 @@ export default function PlanItem({
|
||||||
const workout = item.workouts.split(',')[0]
|
const workout = item.workouts.split(',')[0]
|
||||||
let first = await getBestSet(workout)
|
let first = await getBestSet(workout)
|
||||||
if (!first) first = {...defaultSet, name: workout}
|
if (!first) first = {...defaultSet, name: workout}
|
||||||
|
delete first.id
|
||||||
navigation.navigate('StartPlan', {plan: item, first})
|
navigation.navigate('StartPlan', {plan: item, first})
|
||||||
}, [item, navigation])
|
}, [item, navigation])
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {RouteProp, useFocusEffect, useRoute} from '@react-navigation/native'
|
||||||
import {useCallback, useMemo, useRef, useState} from 'react'
|
import {useCallback, useMemo, useRef, useState} from 'react'
|
||||||
import {NativeModules, TextInput, View} from 'react-native'
|
import {NativeModules, TextInput, View} from 'react-native'
|
||||||
import {FlatList} from 'react-native-gesture-handler'
|
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 {getBestSet} from './best.service'
|
||||||
import {PADDING} from './constants'
|
import {PADDING} from './constants'
|
||||||
import CountMany from './count-many'
|
import CountMany from './count-many'
|
||||||
|
@ -155,12 +155,17 @@ export default function StartPlan() {
|
||||||
<FlatList
|
<FlatList
|
||||||
data={counts}
|
data={counts}
|
||||||
renderItem={props => (
|
renderItem={props => (
|
||||||
|
<View>
|
||||||
<StartPlanItem
|
<StartPlanItem
|
||||||
{...props}
|
{...props}
|
||||||
onUndo={refresh}
|
onUndo={refresh}
|
||||||
onSelect={select}
|
onSelect={select}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
/>
|
/>
|
||||||
|
<ProgressBar
|
||||||
|
progress={(props.item.total || 0) / (props.item.sets || 3)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user