@@ -15,6 +15,7 @@ import {
1515 KeyboardAvoidingView ,
1616 Platform ,
1717 Pressable ,
18+ ScrollView ,
1819 StyleSheet ,
1920 Text ,
2021 TouchableOpacity ,
@@ -399,60 +400,66 @@ export function BookChatScreen({ route, navigation }: Props) {
399400 < XIcon size = { 16 } color = { colors . foreground } />
400401 </ TouchableOpacity >
401402 </ View >
402- { bookThreads . length === 0 ? (
403- < View style = { s . sidebarEmpty } >
404- < Text style = { s . sidebarEmptyText } > { t ( "chat.noConversations" , "暂无对话" ) } </ Text >
405- </ View >
406- ) : (
407- groupedThreads . map ( ( { key, label, threads } ) => {
408- if ( threads . length === 0 ) return null ;
409- return (
410- < View key = { key } >
411- < Text style = { s . sectionLabel } > { label } </ Text >
412- { threads . map ( ( thread ) => {
413- const isActive = thread . id === activeThreadId ;
414- const lastMsg =
415- thread . messages . length > 0
416- ? thread . messages [ thread . messages . length - 1 ]
417- : null ;
418- const preview = lastMsg ?. content ?. slice ( 0 , 60 ) || "" ;
419- return (
420- < TouchableOpacity
421- key = { thread . id }
422- style = { [ s . threadItem , isActive && s . threadItemActive ] }
423- onPress = { ( ) => handleSelectThread ( thread . id ) }
424- activeOpacity = { 0.7 }
425- >
426- < View style = { s . threadContent } >
427- < View style = { s . threadTitleRow } >
428- < Text
429- style = { [ s . threadTitle , isActive && s . threadTitleActive ] }
430- numberOfLines = { 1 }
431- >
432- { thread . title || t ( "chat.newChat" , "新对话" ) }
433- </ Text >
434- < Text style = { s . threadTime } > { formatTime ( thread . updatedAt ) } </ Text >
435- </ View >
436- { preview ? (
437- < Text style = { s . threadPreview } numberOfLines = { 1 } >
438- { preview }
439- </ Text >
440- ) : null }
441- </ View >
403+ < ScrollView
404+ style = { { flex : 1 } }
405+ contentContainerStyle = { { paddingBottom : 20 } }
406+ showsVerticalScrollIndicator = { false }
407+ >
408+ { bookThreads . length === 0 ? (
409+ < View style = { s . sidebarEmpty } >
410+ < Text style = { s . sidebarEmptyText } > { t ( "chat.noConversations" , "暂无对话" ) } </ Text >
411+ </ View >
412+ ) : (
413+ groupedThreads . map ( ( { key, label, threads } ) => {
414+ if ( threads . length === 0 ) return null ;
415+ return (
416+ < View key = { key } >
417+ < Text style = { s . sectionLabel } > { label } </ Text >
418+ { threads . map ( ( thread ) => {
419+ const isActive = thread . id === activeThreadId ;
420+ const lastMsg =
421+ thread . messages . length > 0
422+ ? thread . messages [ thread . messages . length - 1 ]
423+ : null ;
424+ const preview = lastMsg ?. content ?. slice ( 0 , 60 ) || "" ;
425+ return (
442426 < TouchableOpacity
443- style = { s . threadDeleteBtn }
444- onPress = { ( ) => removeThread ( thread . id ) }
445- hitSlop = { { top : 8 , bottom : 8 , left : 8 , right : 8 } }
427+ key = { thread . id }
428+ style = { [ s . threadItem , isActive && s . threadItemActive ] }
429+ onPress = { ( ) => handleSelectThread ( thread . id ) }
430+ activeOpacity = { 0.7 }
446431 >
447- < Trash2Icon size = { 12 } color = { colors . mutedForeground } />
432+ < View style = { s . threadContent } >
433+ < View style = { s . threadTitleRow } >
434+ < Text
435+ style = { [ s . threadTitle , isActive && s . threadTitleActive ] }
436+ numberOfLines = { 1 }
437+ >
438+ { thread . title || t ( "chat.newChat" , "新对话" ) }
439+ </ Text >
440+ < Text style = { s . threadTime } > { formatTime ( thread . updatedAt ) } </ Text >
441+ </ View >
442+ { preview ? (
443+ < Text style = { s . threadPreview } numberOfLines = { 1 } >
444+ { preview }
445+ </ Text >
446+ ) : null }
447+ </ View >
448+ < TouchableOpacity
449+ style = { s . threadDeleteBtn }
450+ onPress = { ( ) => removeThread ( thread . id ) }
451+ hitSlop = { { top : 8 , bottom : 8 , left : 8 , right : 8 } }
452+ >
453+ < Trash2Icon size = { 12 } color = { colors . mutedForeground } />
454+ </ TouchableOpacity >
448455 </ TouchableOpacity >
449- </ TouchableOpacity >
450- ) ;
451- } ) }
452- </ View >
453- ) ;
454- } )
455- ) }
456+ ) ;
457+ } ) }
458+ </ View >
459+ ) ;
460+ } )
461+ ) }
462+ </ ScrollView >
456463 </ Animated . View >
457464 </ View >
458465 ) }
0 commit comments