11import { useSelector } from '@legendapp/state/react' ;
2- import { useKeyboard } from '@react-native-community/hooks' ;
32import { useTranslation } from '@ronas-it/react-native-common-modules/i18n' ;
43import dayjs from 'dayjs' ;
54import { delay } from 'lodash-es' ;
@@ -14,9 +13,8 @@ import { useSendMessage } from '@open-webui-react-native/mobile/chat/features/us
1413import { useSuggestChange } from '@open-webui-react-native/mobile/chat/features/use-suggest-change' ;
1514import { useAttachedFiles } from '@open-webui-react-native/mobile/shared/features/use-attached-files' ;
1615import { cn } from '@open-webui-react-native/mobile/shared/ui/styles' ;
17- import { AppSpinner , View } from '@open-webui-react-native/mobile/shared/ui/ui-kit' ;
16+ import { AppKeyboardStickyView , AppSpinner , View } from '@open-webui-react-native/mobile/shared/ui/ui-kit' ;
1817import { FormValues } from '@open-webui-react-native/mobile/shared/utils/form' ;
19- import { useBottomInset } from '@open-webui-react-native/mobile/shared/utils/use-bottom-inset' ;
2018import { chatApi , ChatGenerationOption , chatQueriesKeys } from '@open-webui-react-native/shared/data-access/api' ;
2119import { Role } from '@open-webui-react-native/shared/data-access/common' ;
2220import { useSubscribeToQueryCache } from '@open-webui-react-native/shared/data-access/query-client' ;
@@ -38,8 +36,6 @@ interface ChatProps {
3836export function Chat ( { chatId, selectedModelId, isNewChat, resetToChatsList } : ChatProps ) : ReactElement {
3937 const translate = useTranslation ( 'CHAT.CHAT' ) ;
4038 const translateRegeneratePrompt = useTranslation ( 'CHAT.AI_MESSAGE_ACTIONS.REGENERATE_MESSAGE_ACTION_SHEET' ) ;
41- const bottomInset = useBottomInset ( ) ;
42- const { keyboardShown } = useKeyboard ( ) ;
4339
4440 const [ isInputFocusing , setIsInputFocusing ] = useState ( false ) ; //NOTE: Needs to avoid ChatBottomButton jumping when auto-scrolling after focus
4541
@@ -225,47 +221,47 @@ export function Chat({ chatId, selectedModelId, isNewChat, resetToChatsList }: C
225221 />
226222 </ React . Suspense >
227223 ) }
228- < View
229- style = { ! keyboardShown && { paddingBottom : bottomInset } }
230- className = { cn ( 'pt-8 px-16' , shouldHideContent && 'opacity-0' ) } >
231- { activeInputMode === ActiveInputMode . EDIT && editingMessageId ? (
232- < EditMessageInput
233- control = { editMessageControl }
234- name = 'editMessageInputValue'
235- autoFocus = { true }
236- onSave = { saveMessage }
237- onCancel = { cancelEditingWrapper }
238- onSend = { sendEditedMessage }
239- isAiMessage = { history ?. messages [ editingMessageId ] ?. role === Role . ASSISTANT }
240- />
241- ) : activeInputMode === ActiveInputMode . SUGGEST && suggestingMessageId ? (
242- < SuggestChangeInput
243- control = { suggestMessageControl }
244- name = 'suggestionInputValue'
245- autoFocus
246- onCancel = { cancelSuggestingWrapper }
247- onSend = { submitSuggestion }
248- />
249- ) : (
250- < FormChatInput
251- placeholder = { translate ( 'TEXT_INPUT_PLACEHOLDER' ) }
252- control = { control }
253- onFocus = { handleInputFocus }
254- name = 'inputValue'
255- onSubmit = { onSubmit }
256- isLoading = { isSending || ! isSocketConnected || isResponseGenerating }
257- attachedFiles = { attachedFiles }
258- onFileUploaded = { handleFileUploaded }
259- onDeleteFilePress = { handleDeleteFile }
260- attachedImages = { attachedImages }
261- onImageUploaded = { handleImageUploaded }
262- onDeleteImagePress = { handleDeleteImage }
263- modelId = { selectedModelId }
264- isResponseGenerating = { isResponseGenerating }
265- chat = { chat }
266- />
267- ) }
268- </ View >
224+ < AppKeyboardStickyView className = 'bg-background-primary-transparent' >
225+ < View className = { cn ( 'pt-8 px-16' , shouldHideContent && 'opacity-0' ) } >
226+ { activeInputMode === ActiveInputMode . EDIT && editingMessageId ? (
227+ < EditMessageInput
228+ control = { editMessageControl }
229+ name = 'editMessageInputValue'
230+ autoFocus = { true }
231+ onSave = { saveMessage }
232+ onCancel = { cancelEditingWrapper }
233+ onSend = { sendEditedMessage }
234+ isAiMessage = { history ?. messages [ editingMessageId ] ?. role === Role . ASSISTANT }
235+ />
236+ ) : activeInputMode === ActiveInputMode . SUGGEST && suggestingMessageId ? (
237+ < SuggestChangeInput
238+ control = { suggestMessageControl }
239+ name = 'suggestionInputValue'
240+ autoFocus
241+ onCancel = { cancelSuggestingWrapper }
242+ onSend = { submitSuggestion }
243+ />
244+ ) : (
245+ < FormChatInput
246+ placeholder = { translate ( 'TEXT_INPUT_PLACEHOLDER' ) }
247+ control = { control }
248+ onFocus = { handleInputFocus }
249+ name = 'inputValue'
250+ onSubmit = { onSubmit }
251+ isLoading = { isSending || ! isSocketConnected || isResponseGenerating }
252+ attachedFiles = { attachedFiles }
253+ onFileUploaded = { handleFileUploaded }
254+ onDeleteFilePress = { handleDeleteFile }
255+ attachedImages = { attachedImages }
256+ onImageUploaded = { handleImageUploaded }
257+ onDeleteImagePress = { handleDeleteImage }
258+ modelId = { selectedModelId }
259+ isResponseGenerating = { isResponseGenerating }
260+ chat = { chat }
261+ />
262+ ) }
263+ </ View >
264+ </ AppKeyboardStickyView >
269265 </ Fragment >
270266 ) ;
271267}
0 commit comments