Replace height percent setting with flex: 1

This way reacts better to changing the screen sizes.
I think there was one bug where the fab wouldn't be
precisely at the bottom of the page depending on the
flat list length.
This commit is contained in:
Brandon Presley 2022-10-14 18:12:21 +13:00
parent 46f0875497
commit 9bd8fa9353
8 changed files with 9 additions and 14 deletions

View File

@ -65,11 +65,7 @@ export default function BestList() {
description="Once sets have been added, this will highlight your personal bests."
/>
) : (
<FlatList
style={{height: '99%'}}
renderItem={renderItem}
data={bests}
/>
<FlatList style={{flex: 1}} renderItem={renderItem} data={bests} />
)}
</Page>
);

View File

@ -87,8 +87,8 @@ export default function EditPlan() {
);
return (
<View style={{padding: PADDING}}>
<ScrollView style={{height: '90%'}}>
<View style={{padding: PADDING, flex: 1}}>
<ScrollView style={{flex: 1}}>
<Text style={styles.title}>Days</Text>
{DAYS.map(day => (
<Switch

View File

@ -118,8 +118,8 @@ export default function EditWorkout() {
};
return (
<View style={{padding: PADDING}}>
<ScrollView style={{height: '90%'}}>
<View style={{padding: PADDING, flex: 1}}>
<ScrollView style={{flex: 1}}>
<MassiveInput
autoFocus
label="Name"

View File

@ -18,7 +18,7 @@ export default function MassiveFab(
style={{
position: 'absolute',
right: 10,
bottom: 60,
bottom: 10,
backgroundColor: color,
}}
{...props}

View File

@ -34,6 +34,5 @@ const styles = StyleSheet.create({
container: {
flexGrow: 1,
padding: PADDING,
paddingBottom: '10%',
},
});

View File

@ -54,7 +54,7 @@ export default function PlanList() {
/>
) : (
<FlatList
style={{height: '99%'}}
style={{flex: 1}}
data={plans}
renderItem={renderItem}
keyExtractor={set => set.id?.toString() || ''}

View File

@ -95,7 +95,7 @@ export default function SetList() {
) : (
<FlatList
data={sets}
style={{height: '99%'}}
style={{flex: 1}}
renderItem={renderItem}
keyExtractor={s => s.id!.toString()}
onEndReached={next}

View File

@ -88,7 +88,7 @@ export default function WorkoutList() {
) : (
<FlatList
data={workouts}
style={{height: '99%'}}
style={{flex: 1}}
renderItem={renderItem}
keyExtractor={w => w.name}
onEndReached={next}