fix: project picker scroll, reconnect scroll, keyboard dismiss
- Project picker wrapped in ScrollView with maxHeight 300
- MessageList uses longer delay (200ms) for bulk loads (reconnect/switch)
- InputBar dismisses keyboard after sending text message
| .. | .. |
|---|
| 11 | 11 | Keyboard, |
|---|
| 12 | 12 | LayoutAnimation, |
|---|
| 13 | 13 | Pressable, |
|---|
| 14 | + ScrollView, |
|---|
| 14 | 15 | StyleSheet, |
|---|
| 15 | 16 | Text, |
|---|
| 16 | 17 | TextInput, |
|---|
| .. | .. |
|---|
| 556 | 557 | </View> |
|---|
| 557 | 558 | |
|---|
| 558 | 559 | {showProjectPicker && ( |
|---|
| 559 | | - <View style={{ |
|---|
| 560 | | - marginHorizontal: 12, |
|---|
| 561 | | - borderRadius: 12, |
|---|
| 562 | | - backgroundColor: colors.bgTertiary, |
|---|
| 563 | | - overflow: "hidden", |
|---|
| 564 | | - }}> |
|---|
| 560 | + <ScrollView |
|---|
| 561 | + style={{ |
|---|
| 562 | + marginHorizontal: 12, |
|---|
| 563 | + borderRadius: 12, |
|---|
| 564 | + backgroundColor: colors.bgTertiary, |
|---|
| 565 | + maxHeight: 300, |
|---|
| 566 | + }} |
|---|
| 567 | + keyboardShouldPersistTaps="handled" |
|---|
| 568 | + > |
|---|
| 565 | 569 | {/* Home directory — always first */} |
|---|
| 566 | 570 | <Pressable |
|---|
| 567 | 571 | onPress={() => launchSession({ path: "~" })} |
|---|
| .. | .. |
|---|
| 645 | 649 | </Pressable> |
|---|
| 646 | 650 | )} |
|---|
| 647 | 651 | </View> |
|---|
| 648 | | - </View> |
|---|
| 652 | + </ScrollView> |
|---|
| 649 | 653 | )} |
|---|
| 650 | 654 | </View> |
|---|
| 651 | 655 | |
|---|
| .. | .. |
|---|
| 38 | 38 | if (!trimmed) return; |
|---|
| 39 | 39 | onSendText(trimmed); |
|---|
| 40 | 40 | setText(""); |
|---|
| 41 | + Keyboard.dismiss(); |
|---|
| 41 | 42 | }, [text, onSendText]); |
|---|
| 42 | 43 | |
|---|
| 43 | 44 | if (!isTextMode) { |
|---|
| .. | .. |
|---|
| 20 | 20 | |
|---|
| 21 | 21 | useEffect(() => { |
|---|
| 22 | 22 | if (messages.length > 0) { |
|---|
| 23 | | - // If the message count changed by more than 1, it's a session switch — |
|---|
| 24 | | - // snap to bottom instantly instead of visibly scrolling down. |
|---|
| 23 | + // If the message count changed by more than 1, it's a session switch or |
|---|
| 24 | + // initial load — snap to bottom instantly instead of visibly scrolling. |
|---|
| 25 | 25 | const delta = Math.abs(messages.length - prevLengthRef.current); |
|---|
| 26 | 26 | const animated = delta === 1; |
|---|
| 27 | + const delay = delta > 1 ? 200 : 50; |
|---|
| 27 | 28 | setTimeout(() => { |
|---|
| 28 | 29 | listRef.current?.scrollToEnd({ animated }); |
|---|
| 29 | | - }, 50); |
|---|
| 30 | + }, delay); |
|---|
| 30 | 31 | } |
|---|
| 31 | 32 | prevLengthRef.current = messages.length; |
|---|
| 32 | 33 | }, [messages.length, isTyping, lastContent]); |
|---|