Skip to content

Commit 746c8cc

Browse files
committed
Fix tasks page header not flush with top of screen
Remove SafeAreaView from available-pick-ups — it was double-stacking top insets (SafeAreaView's automatic padding + header paddingTop:58), causing the white header to appear pushed down with a gray gap behind the status bar. Now matches the same pattern as my-tasks (plain View + paddingTop:58 to clear the status bar). Also bumps contentContainer paddingBottom to 140 to clear the tab bar and home indicator.
1 parent 7080a93 commit 746c8cc

2 files changed

Lines changed: 77 additions & 55 deletions

File tree

src/app/(tabs)/available-pick-ups.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import {
55
Image,
66
Pressable,
77
RefreshControl,
8-
SafeAreaView,
98
Text,
109
TouchableOpacity,
1110
View,
1211
} from 'react-native';
1312
import { router } from 'expo-router';
1413
import AsyncStorage from '@react-native-async-storage/async-storage';
1514
import clockIcon from 'assets/date.png';
16-
import replateLogo from 'assets/replate-logo.png';
1715
import AnimatedSegmentedControl from '@/components/AnimatedSegmentedControl';
1816
import { useAuth } from '@/utils/AuthContext';
1917
import { ApiError, apiRequest, validateArrayResponse } from '~/api/apiUtils';
@@ -127,6 +125,11 @@ type UiPickup = {
127125

128126
export default function AvailablePickupsPage() {
129127
const todayISO = localISODate(new Date());
128+
const headerDate = new Date().toLocaleDateString('en-US', {
129+
weekday: 'long',
130+
month: 'long',
131+
day: 'numeric',
132+
});
130133

131134
const tomorrowISO = React.useMemo(() => {
132135
const d = new Date();
@@ -219,7 +222,7 @@ export default function AvailablePickupsPage() {
219222

220223
if (!driverId) {
221224
return (
222-
<SafeAreaView style={styles.safeAreaContainer}>
225+
<View style={styles.safeAreaContainer}>
223226
<View
224227
style={{
225228
flex: 1,
@@ -246,12 +249,12 @@ export default function AvailablePickupsPage() {
246249
</Text>
247250
</TouchableOpacity>
248251
</View>
249-
</SafeAreaView>
252+
</View>
250253
);
251254
}
252255

253256
return (
254-
<SafeAreaView style={styles.safeAreaContainer}>
257+
<View style={styles.safeAreaContainer}>
255258
<FlatList
256259
data={filtered}
257260
keyExtractor={item => item.encrypted_id}
@@ -277,12 +280,18 @@ export default function AvailablePickupsPage() {
277280
</View>
278281
) : null}
279282
<View style={styles.header}>
280-
<View style={styles.brandRow}>
281-
<Text style={styles.replateTitle}>Replate</Text>
282-
<Image style={styles.logo} source={replateLogo} />
283+
<View style={styles.headerTopRow}>
284+
<Text style={styles.date}>{headerDate}</Text>
285+
<View style={styles.avatarCircle}>
286+
<Text style={styles.avatarLetter}>
287+
{(driver?.first_name || '?')[0]}
288+
</Text>
289+
</View>
283290
</View>
284-
<Text style={styles.availableTasksTitle}>
285-
Available Tasks ({filtered.length})
291+
<Text style={styles.greeting}>Available Tasks</Text>
292+
<Text style={styles.subtext}>
293+
{filtered.length} task{filtered.length === 1 ? '' : 's'}{' '}
294+
available
286295
</Text>
287296
<AnimatedSegmentedControl
288297
leftLabel="Today"
@@ -342,6 +351,6 @@ export default function AvailablePickupsPage() {
342351
<Text style={styles.claimPickupText}>No pickups for this date.</Text>
343352
}
344353
/>
345-
</SafeAreaView>
354+
</View>
346355
);
347356
}

src/styles/tabs/available-pick-ups-styles.ts

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,58 @@ export const styles = StyleSheet.create({
99
marginTop: 16,
1010
},
1111
// header
12-
availableTasksTitle: {
13-
fontSize: 28,
12+
header: {
13+
backgroundColor: '#FFFFFF',
14+
paddingHorizontal: 22,
15+
paddingTop: 58,
16+
paddingBottom: 20,
17+
borderBottomWidth: 1,
18+
borderBottomColor: '#D8E0E9',
19+
shadowOpacity: 0.1,
20+
shadowOffset: { width: 0, height: 4 },
21+
shadowRadius: 10,
22+
elevation: 4,
23+
fontFamily: 'Lato',
24+
},
25+
headerTopRow: {
26+
flexDirection: 'row',
27+
justifyContent: 'space-between',
28+
alignItems: 'center',
29+
},
30+
date: {
31+
fontSize: 15,
32+
color: '#525454',
33+
fontFamily: 'Lato',
34+
},
35+
avatarCircle: {
36+
width: 38,
37+
height: 38,
38+
borderRadius: 19,
39+
backgroundColor: '#aeddc4',
40+
borderWidth: 2,
41+
borderColor: '#3ea377',
42+
alignItems: 'center',
43+
justifyContent: 'center',
44+
},
45+
avatarLetter: {
46+
fontSize: 16,
47+
color: '#3EA377',
48+
fontWeight: '600',
1449
fontFamily: 'LatoBold',
15-
fontWeight: '700',
16-
color: '#2C805B',
17-
marginLeft: 26,
18-
marginTop: 27,
19-
marginBottom: 14,
50+
},
51+
greeting: {
52+
color: '#427B60',
53+
textAlign: 'left',
54+
fontFamily: 'LatoBold',
55+
fontSize: 27,
56+
height: 32,
57+
},
58+
subtext: {
59+
textAlign: 'left',
60+
color: '#2D8A60',
61+
fontSize: 15,
62+
marginTop: 12,
63+
fontFamily: 'Lato',
2064
},
2165
segmentWrap: {
2266
flexDirection: 'row',
@@ -52,41 +96,6 @@ export const styles = StyleSheet.create({
5296
segmentTextInactive: {
5397
color: Colors.black,
5498
},
55-
header: {
56-
backgroundColor: '#FFFFFF',
57-
// creates the “header container” separation
58-
...Platform.select({
59-
ios: {
60-
shadowColor: '#000',
61-
shadowOpacity: 0.08,
62-
shadowRadius: 10,
63-
shadowOffset: { width: 0, height: 6 },
64-
},
65-
android: {
66-
elevation: 6,
67-
},
68-
}),
69-
70-
// keeps the shadow from being clipped by the next content
71-
marginBottom: 14,
72-
},
73-
replateTitle: {
74-
fontSize: 18,
75-
fontFamily: 'Lato',
76-
color: '#3EA377',
77-
fontWeight: '400',
78-
},
79-
logo: {
80-
height: 30,
81-
width: 30,
82-
},
83-
brandRow: {
84-
flexDirection: 'row',
85-
alignItems: 'center', // vertical centering
86-
justifyContent: 'center', // horizontal centering
87-
gap: 5, // space between text & logo
88-
marginTop: 12,
89-
},
9099
//cards
91100
pickupCard: {
92101
marginHorizontal: 16,
@@ -191,7 +200,7 @@ export const styles = StyleSheet.create({
191200
color: '#427B60',
192201
},
193202
contentContainer: {
194-
paddingBottom: 24,
203+
paddingBottom: 140,
195204
},
196205
claimPickupText: {
197206
textAlign: 'center',
@@ -202,7 +211,8 @@ export const styles = StyleSheet.create({
202211
},
203212
safeAreaContainer: {
204213
flex: 1,
205-
backgroundColor: '#f8f8f8',
214+
backgroundColor: '#EAEEF2',
215+
paddingTop: 0,
206216
},
207217
loadingContainer: {
208218
flex: 1,
@@ -216,6 +226,9 @@ export const styles = StyleSheet.create({
216226
},
217227
itemSeparator: {
218228
height: 12,
229+
borderBottomWidth: 1,
230+
borderBottomColor: '#EDF1F7',
231+
marginHorizontal: 16,
219232
},
220233
//[id] styles
221234
detailsSections: {

0 commit comments

Comments
 (0)