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); const db = useContext(DatabaseContext);
useEffect(() => { useEffect(() => {
if (set) if (set?.id)
setNewSet({ setNewSet({
...set, ...set,
reps: set.reps.toString(), reps: set.reps.toString(),

View File

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

View File

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