FaridSafi / react-native-gifted-chat

💬 The most complete chat UI for React Native
https://gifted.chat
MIT License
13.45k stars 3.54k forks source link

iOS keyboard covering textinput #2524

Open HaythamT95 opened 2 weeks ago

HaythamT95 commented 2 weeks ago

Issue Description

Only happens in development build on iOS using npx expo run:ios

Screenshot 2024-08-31 at 11 11 39 Screenshot 2024-08-31 at 10 55 22 Screenshot 2024-08-31 at 11 08 36 Screenshot 2024-08-31 at 11 03 43

Steps to Reproduce / Code Snippets

Additional information

HaidarZ commented 2 weeks ago

Same here, on iOS the input is covered and on android the input is over sized. It used to work normally on v2.4.0

steavenb commented 2 weeks ago

I inspected the GiftedChat.js file in node_modules/react-native-gifted-chat/lib/GiftedChat.js - line 238

I changed keyboardOffsetBottom.value = withTiming(isKeyboardMovingUp ? insets.bottom : 0, { duration: 400, }); to this keyboardOffsetBottom.value = withTiming(isKeyboardMovingUp ? 0 : 0, { duration: 400, }); .

We don't need to these changes if the screen is wrapped in a safeareaview itself but it messes up with the navigation since I use react-navigation.

I have used patch-package to fix this issue till someone releases an update.

HaythamT95 commented 2 weeks ago

I fixed the problem by wrapping the GiftedChat component in SafeAreaView instead of View

<SafeAreaView>
     <GiftedChat .../>
</SafeAreaView>

But the xCode warnings still appear in the terminal

niteshagrawal commented 1 week ago

for anyone facing this keyboard issue, i created this patch .

react-native-gifted-chat+2.6.2.patch

OR

in node_modules/react-native-gifted-chat/lib/GiftedChat.js

update this line —> transform: [ {translateY: -keyboard.height.value + keyboardOffsetBottom.value }, ]

with this line —> transform: [ {translateY: 0}, ]

nikita10001 commented 1 week ago

for anyone facing this keyboard issue, i created this patch .

react-native-gifted-chat+2.6.2.patch

OR

in node_modules/react-native-gifted-chat/lib/GiftedChat.js

update this line —> transform: [ {translateY: -keyboard.height.value + keyboardOffsetBottom.value }, ]

with this line —> transform: [ {translateY: 0}, ]

but the keyboard hides the content now, do you know how to fix this issue?