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+
15import { useUser } from '@clerk/clerk-expo' ;
26import { Ionicons } from '@expo/vector-icons' ;
37import { BottomSheetModal } from '@gorhom/bottom-sheet' ;
@@ -6,19 +10,11 @@ import { useFocusEffect } from '@react-navigation/native';
610import { FlashList , type FlashList as FlashListType } from '@shopify/flash-list' ;
711import * as Haptics from 'expo-haptics' ;
812import { 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
1314import { type Folder , type Note , useApiService } from '@/src/services/api' ;
1415import { useTheme } from '@/src/theme' ;
1516import { 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-
2218import { CreateFolderSheet } from './CreateFolderSheet' ;
2319import { EmptyState } from './EmptyState' ;
2420import { FilterConfig , FilterSortSheet , SortConfig } from './FilterSortSheet' ;
@@ -30,6 +26,11 @@ import { useFolderPaths } from './useFolderPaths';
3026import { useNotesFiltering } from './useNotesFiltering' ;
3127import { 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+
3334interface 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 } ,
0 commit comments