From 9338f33f158db6b9a9400924e286baa0b84480a1 Mon Sep 17 00:00:00 2001 From: Rusyaidi Date: Mon, 26 Feb 2024 01:02:59 +0800 Subject: [PATCH] fix: chatitem scrolling out of view closing keyboard --- components/ChatMenu/ChatWindow/ChatItem.tsx | 8 +++++- components/ChatMenu/ChatWindow/ChatWindow.tsx | 25 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/components/ChatMenu/ChatWindow/ChatItem.tsx b/components/ChatMenu/ChatWindow/ChatItem.tsx index 32312da..efe5dfe 100644 --- a/components/ChatMenu/ChatWindow/ChatItem.tsx +++ b/components/ChatMenu/ChatWindow/ChatItem.tsx @@ -109,7 +109,12 @@ const ChatItem: React.FC = ({ {showEditor && ( - + {id !== 0 && ( )} @@ -129,6 +134,7 @@ const ChatItem: React.FC = ({ onChangeText={setPlaceholderText} textBreakStrategy="simple" multiline + autoFocus /> diff --git a/components/ChatMenu/ChatWindow/ChatWindow.tsx b/components/ChatMenu/ChatWindow/ChatWindow.tsx index 800a03f..e6c0dca 100644 --- a/components/ChatMenu/ChatWindow/ChatWindow.tsx +++ b/components/ChatMenu/ChatWindow/ChatWindow.tsx @@ -1,6 +1,6 @@ -import { StyleSheet, KeyboardAvoidingView, FlatList } from 'react-native' +import { StyleSheet, FlatList } from 'react-native' import { ChatItem } from './ChatItem' -import { Chats, Color, Global } from '@globals' +import { Chats, Global } from '@globals' import { useMMKVBoolean, useMMKVString } from 'react-native-mmkv' import { useEffect, useRef } from 'react' @@ -46,16 +46,17 @@ const ChatWindow = () => { } return ( - - item.key.toString()} - renderItem={renderItems} - /> - + item.key.toString()} + renderItem={renderItems} + /> ) }