Skip to content

Commit d64dba5

Browse files
committed
fix(mobile): improve folder notes UI consistency and FAB behavior
1 parent bdd5184 commit d64dba5

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

apps/mobile/v1/src/screens/FolderNotes/components/NotesList/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2+
import { ActivityIndicator, Alert, Animated, DeviceEventEmitter, InteractionManager, Pressable, RefreshControl, StyleSheet, View } from 'react-native';
3+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
4+
15
import { useUser } from '@clerk/clerk-expo';
26
import { Ionicons } from '@expo/vector-icons';
37
import { BottomSheetModal } from '@gorhom/bottom-sheet';
@@ -6,19 +10,11 @@ import { useFocusEffect } from '@react-navigation/native';
610
import { FlashList, type FlashList as FlashListType } from '@shopify/flash-list';
711
import * as Haptics from 'expo-haptics';
812
import { useRouter } from 'expo-router';
9-
import React, { useCallback,useEffect, useMemo, useRef, useState } from 'react';
10-
import { ActivityIndicator, Alert, Animated, DeviceEventEmitter, InteractionManager, Pressable, RefreshControl, StyleSheet, View } from 'react-native';
11-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1213

1314
import { type Folder, type Note, useApiService } from '@/src/services/api';
1415
import { useTheme } from '@/src/theme';
1516
import { stripHtmlTags } from '@/src/utils/noteUtils';
1617

17-
// Constants for FAB scroll behavior
18-
const FAB_SCROLL_THRESHOLD_START = 100; // Start showing FAB when scrolled past this
19-
const FAB_SCROLL_THRESHOLD_END = 140; // Fully visible at this scroll position
20-
const FAB_ANIMATION_DISTANCE = 20; // Distance to slide up during animation
21-
2218
import { CreateFolderSheet } from './CreateFolderSheet';
2319
import { EmptyState } from './EmptyState';
2420
import { FilterConfig, FilterSortSheet, SortConfig } from './FilterSortSheet';
@@ -30,6 +26,11 @@ import { useFolderPaths } from './useFolderPaths';
3026
import { useNotesFiltering } from './useNotesFiltering';
3127
import { useNotesLoader } from './useNotesLoader';
3228

29+
// Constants for FAB scroll behavior
30+
const FAB_SCROLL_THRESHOLD_START = 280; // Start showing FAB when scrolled past this
31+
const FAB_SCROLL_THRESHOLD_END = 320; // Fully visible at this scroll position
32+
const FAB_ANIMATION_DISTANCE = 20; // Distance to slide up during animation
33+
3334
interface RouteParams {
3435
folderId?: string;
3536
viewType?: 'all' | 'starred' | 'archived' | 'trash';
@@ -109,7 +110,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
109110
// Show FAB when scrolled past the header
110111
const fabOpacity = scrollY.interpolate({
111112
inputRange: [FAB_SCROLL_THRESHOLD_START, FAB_SCROLL_THRESHOLD_END],
112-
outputRange: [0, 1],
113+
outputRange: [0, 0.8],
113114
extrapolate: 'clamp',
114115
});
115116

@@ -227,7 +228,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
227228

228229
const handleFolderCreated = useCallback((folder: Folder & { noteCount: number }) => {
229230
setSubfolders(prev => [...prev, folder]);
230-
}, []);
231+
}, [setSubfolders]);
231232

232233
const onRefresh = async () => {
233234
try {
@@ -249,7 +250,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
249250
}
250251
};
251252

252-
const handleEmptyTrash = async () => {
253+
const handleEmptyTrash = useCallback(async () => {
253254
const deletedNotes = notes.filter(note => note.deleted);
254255

255256
Alert.alert(
@@ -303,7 +304,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
303304
},
304305
]
305306
);
306-
};
307+
}, [notes, setNotes, api, router]);
307308

308309
// Lazy cache for note previews and dates (only calculate when rendered)
309310
// DON'T clear this cache - let it persist across updates
@@ -646,7 +647,6 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
646647
keyExtractor={(item) => item.id}
647648
ListHeaderComponent={renderListHeader}
648649
ListEmptyComponent={renderEmptyComponent}
649-
ListFooterComponent={<View style={{ height: 120 }} />}
650650
showsVerticalScrollIndicator={false}
651651
onScroll={Animated.event(
652652
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
@@ -753,7 +753,7 @@ const styles = StyleSheet.create({
753753
position: 'absolute',
754754
width: 40,
755755
height: 40,
756-
borderRadius: 6,
756+
borderRadius: 20,
757757
elevation: 4,
758758
shadowColor: '#000',
759759
shadowOffset: { width: 0, height: 2 },
@@ -763,7 +763,7 @@ const styles = StyleSheet.create({
763763
fabButton: {
764764
width: 40,
765765
height: 40,
766-
borderRadius: 6,
766+
borderRadius: 20,
767767
justifyContent: 'center',
768768
alignItems: 'center',
769769
},

apps/mobile/v1/src/screens/FolderNotes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export default function FolderNotesScreen({ folderId, folderName, viewType }: Fo
299299
<View style={[styles.headerContainer, { backgroundColor: theme.colors.background, borderBottomColor: theme.colors.border }]}>
300300
<View style={styles.header}>
301301
<TouchableOpacity
302-
style={styles.iconButton}
302+
style={[styles.iconButton, { backgroundColor: theme.colors.muted }]}
303303
onPress={() => router.back()}
304304
>
305305
<Ionicons name="chevron-back" size={20} color={theme.colors.mutedForeground} style={{ marginLeft: -2 }} />

0 commit comments

Comments
 (0)