Fix add button in homepage

This commit is contained in:
Brandon Presley 2022-07-08 14:43:31 +12:00
parent 7fdb576e27
commit dc21f1266e
3 changed files with 7 additions and 4 deletions

View File

@ -24,7 +24,7 @@ export default function EditSet({
const db = useContext(DatabaseContext);
useEffect(() => {
if (set)
if (set?.id)
setNewSet({
...set,
reps: set.reps.toString(),

View File

@ -84,6 +84,7 @@ export default function Home() {
<Searchbar placeholder="Search" value={search} onChangeText={setSearch} />
<FlatList
data={sets}
style={{height: '100%'}}
ListEmptyComponent={
<List.Item
title="No sets yet"
@ -102,8 +103,8 @@ export default function Home() {
extended={false}
label="Add"
icon="add"
style={{position: 'absolute', right: 60, bottom: 70}}
onPress={() => setEdit(undefined)}
style={{position: 'absolute', right: 10, bottom: 50}}
onPress={() => setEdit({} as Set)}
/>
</View>
);

View File

@ -44,6 +44,7 @@ export default function Plans() {
<View style={styles.container}>
<Searchbar value={search} onChangeText={setSearch} placeholder="Search" />
<FlatList
style={{height: '100%'}}
data={plans}
renderItem={renderItem}
keyExtractor={set => set.id.toString()}
@ -71,7 +72,7 @@ export default function Plans() {
extended={false}
label="Add"
icon="add"
style={{position: 'absolute', right: 20, bottom: 20}}
style={{position: 'absolute', right: 20, bottom: 50}}
onPress={() => {
setPlan(undefined);
setShowEdit(true);
@ -85,6 +86,7 @@ const styles = StyleSheet.create({
container: {
flexGrow: 1,
padding: 10,
paddingBottom: '10%',
},
progress: {
marginTop: 10,