From 281834df3070cfbdfc28314ab2a2e84d321ca5df Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sat, 07 Mar 2026 14:06:30 +0100
Subject: [PATCH] fix: project picker scroll, reconnect scroll, keyboard dismiss

---
 components/SessionDrawer.tsx    |   18 +++++++++++-------
 components/chat/InputBar.tsx    |    1 +
 components/chat/MessageList.tsx |    7 ++++---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/components/SessionDrawer.tsx b/components/SessionDrawer.tsx
index 4efb87c..8557fa0 100644
--- a/components/SessionDrawer.tsx
+++ b/components/SessionDrawer.tsx
@@ -11,6 +11,7 @@
   Keyboard,
   LayoutAnimation,
   Pressable,
+  ScrollView,
   StyleSheet,
   Text,
   TextInput,
@@ -556,12 +557,15 @@
               </View>
 
               {showProjectPicker && (
-                <View style={{
-                  marginHorizontal: 12,
-                  borderRadius: 12,
-                  backgroundColor: colors.bgTertiary,
-                  overflow: "hidden",
-                }}>
+                <ScrollView
+                  style={{
+                    marginHorizontal: 12,
+                    borderRadius: 12,
+                    backgroundColor: colors.bgTertiary,
+                    maxHeight: 300,
+                  }}
+                  keyboardShouldPersistTaps="handled"
+                >
                   {/* Home directory — always first */}
                   <Pressable
                     onPress={() => launchSession({ path: "~" })}
@@ -645,7 +649,7 @@
                       </Pressable>
                     )}
                   </View>
-                </View>
+                </ScrollView>
               )}
             </View>
 
diff --git a/components/chat/InputBar.tsx b/components/chat/InputBar.tsx
index b002775..2e47666 100644
--- a/components/chat/InputBar.tsx
+++ b/components/chat/InputBar.tsx
@@ -38,6 +38,7 @@
     if (!trimmed) return;
     onSendText(trimmed);
     setText("");
+    Keyboard.dismiss();
   }, [text, onSendText]);
 
   if (!isTextMode) {
diff --git a/components/chat/MessageList.tsx b/components/chat/MessageList.tsx
index 6ec43bb..b413d2b 100644
--- a/components/chat/MessageList.tsx
+++ b/components/chat/MessageList.tsx
@@ -20,13 +20,14 @@
 
   useEffect(() => {
     if (messages.length > 0) {
-      // If the message count changed by more than 1, it's a session switch —
-      // snap to bottom instantly instead of visibly scrolling down.
+      // If the message count changed by more than 1, it's a session switch or
+      // initial load — snap to bottom instantly instead of visibly scrolling.
       const delta = Math.abs(messages.length - prevLengthRef.current);
       const animated = delta === 1;
+      const delay = delta > 1 ? 200 : 50;
       setTimeout(() => {
         listRef.current?.scrollToEnd({ animated });
-      }, 50);
+      }, delay);
     }
     prevLengthRef.current = messages.length;
   }, [messages.length, isTyping, lastContent]);

--
Gitblit v1.3.1