Skip to content

Commit 0140757

Browse files
fix: dismiss keyboard before opening bottom sheets on Android
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 60d6d22 commit 0140757

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

components/chat-screen/ChatBar.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
StyleSheet,
1616
Image,
1717
ActivityIndicator,
18+
Keyboard,
1819
} from 'react-native';
1920
import ImageSourceSheet from '../bottomSheets/ImageSourceSheet';
2021
import { useImageAttachment } from '../../hooks/useImageAttachment';
@@ -77,7 +78,7 @@ const ChatBar = ({
7778
imageSourceSheetRef,
7879
pickFromLibrary,
7980
pickFromCamera,
80-
openSourceSheet: handleAttachImage,
81+
openSourceSheet: openImageSourceSheet,
8182
clearImage,
8283
} = useImageAttachment();
8384

@@ -103,6 +104,12 @@ const ChatBar = ({
103104
}
104105
};
105106

107+
const handleAttachImage = useCallback(() => {
108+
Keyboard.dismiss();
109+
loadSelectedModel();
110+
openImageSourceSheet();
111+
}, [loadSelectedModel, openImageSourceSheet]);
112+
106113
const isVisionModel = model?.vision === true;
107114

108115
useEffect(() => {

components/chat-screen/ChatScreen.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ export default function ChatScreen({
114114
chat?.enabledSources || phantomChat?.enabledSources || [];
115115

116116
const handlePresentModelSheet = useCallback(() => {
117+
Keyboard.dismiss();
117118
modelBottomSheetModalRef.current?.present();
118119
}, []);
119120

120121
const handlePresentSourceSheet = useCallback(() => {
122+
Keyboard.dismiss();
121123
sourceBottomSheetModalRef.current?.present();
122124
}, []);
123125

0 commit comments

Comments
 (0)