Skip to content

Commit 9173ca9

Browse files
committed
Input fields for Workouts don't go off screen, but still headers aren't centered
1 parent 647b0fd commit 9173ca9

File tree

1 file changed

+71
-34
lines changed

1 file changed

+71
-34
lines changed

KonditionExpo/app/workout.tsx

Lines changed: 71 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,37 @@ const SetRow = ({ set, setNumber, onUpdate, onRemove }: SetRowProps) => {
4242
return (
4343
<View style={styles.setRow}>
4444
<Text style={styles.setNumber}>{setNumber}</Text>
45-
<TextInput
46-
style={styles.setInput}
47-
value={set.weight.toString()}
48-
onChangeText={(text) => onUpdate({ weight: parseInt(text) || 0 })}
49-
placeholder="Weight"
50-
keyboardType="numeric"
51-
/>
52-
<Text style={styles.inputLabel}>kg</Text>
53-
<TextInput
54-
style={styles.setInput}
55-
value={set.reps.toString()}
56-
onChangeText={(text) => onUpdate({ reps: parseInt(text) || 0 })}
57-
placeholder="Reps"
58-
keyboardType="numeric"
59-
/>
60-
<Text style={styles.inputLabel}>reps</Text>
45+
46+
<View style={styles.inputGroup}>
47+
<TextInput
48+
style={styles.setInput}
49+
value={set.weight.toString()}
50+
onChangeText={(text) => onUpdate({ weight: parseInt(text) || 0 })}
51+
placeholder="Weight"
52+
keyboardType="numeric"
53+
/>
54+
<Text style={styles.inputUnit}>kg</Text>
55+
</View>
56+
57+
<View style={styles.inputGroup}>
58+
<TextInput
59+
style={styles.setInput}
60+
value={set.reps.toString()}
61+
onChangeText={(text) => onUpdate({ reps: parseInt(text) || 0 })}
62+
placeholder="Reps"
63+
keyboardType="numeric"
64+
/>
65+
<Text style={styles.inputUnit}>reps</Text>
66+
</View>
67+
6168
<TouchableOpacity onPress={onRemove} style={styles.removeButton}>
6269
<Text style={styles.removeButtonText}>×</Text>
6370
</TouchableOpacity>
6471
</View>
6572
);
6673
};
6774

75+
6876
interface ExerciseCardProps {
6977
workoutExercise: any;
7078
onAddSet: () => void;
@@ -358,24 +366,6 @@ const styles = StyleSheet.create({
358366
borderWidth: 1,
359367
borderColor: '#E5F1FF',
360368
},
361-
setNumber: {
362-
fontSize: 16,
363-
fontWeight: '600',
364-
color: '#333',
365-
width: 30,
366-
textAlign: 'center',
367-
},
368-
setInput: {
369-
borderWidth: 1,
370-
borderColor: '#A3C9FD',
371-
borderRadius: 8,
372-
padding: 8,
373-
marginHorizontal: 4,
374-
textAlign: 'center',
375-
fontSize: 16,
376-
backgroundColor: 'white',
377-
flex: 1,
378-
},
379369
inputLabel: {
380370
fontSize: 12,
381371
color: '#666',
@@ -465,6 +455,53 @@ const styles = StyleSheet.create({
465455
paddingVertical: 4,
466456
borderRadius: 6,
467457
},
458+
setRow: {
459+
flexDirection: 'row',
460+
alignItems: 'center',
461+
paddingVertical: 8,
462+
paddingHorizontal: 4,
463+
marginBottom: 8,
464+
backgroundColor: '#FFFFFF',
465+
borderRadius: 8,
466+
borderWidth: 1,
467+
borderColor: '#E5F1FF',
468+
},
469+
470+
setNumber: {
471+
width: 30,
472+
fontSize: 16,
473+
fontWeight: '600',
474+
color: '#333',
475+
textAlign: 'center',
476+
},
477+
478+
inputGroup: {
479+
flexDirection: 'row',
480+
alignItems: 'center',
481+
marginHorizontal: 4,
482+
width: 100, // constrain width for layout stability
483+
},
484+
485+
setInput: {
486+
width: 50, // fixed to prevent stretch
487+
height: 36,
488+
borderWidth: 1,
489+
borderColor: '#A3C9FD',
490+
borderRadius: 8,
491+
paddingHorizontal: 8,
492+
fontSize: 14,
493+
textAlign: 'center',
494+
backgroundColor: '#fff',
495+
},
496+
497+
498+
inputUnit: {
499+
fontSize: 12,
500+
color: '#666',
501+
marginLeft: 4,
502+
alignSelf: 'center',
503+
},
504+
468505
});
469506

470507
export default WorkoutScreen;

0 commit comments

Comments
 (0)