Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS keyboard covering textinput #2524

Open
HaythamT95 opened this issue Aug 31, 2024 · 8 comments
Open

iOS keyboard covering textinput #2524

HaythamT95 opened this issue Aug 31, 2024 · 8 comments

Comments

@HaythamT95
Copy link
Contributor

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

  • opening keyboard
  • typing

Additional information

  • Nodejs version: v20.4.0
  • React version: 18.2.0
  • React Native version: ^0.74.5
  • react-native-gifted-chat version: ^2.6.2
  • Platform(s) (iOS, Android, or both?): iOS
@HaythamT95 HaythamT95 changed the title iOS keyboard above textinput iOS keyboard covering textinput Aug 31, 2024
@HaidarZ
Copy link

HaidarZ commented Aug 31, 2024

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
Copy link

steavenb commented Sep 2, 2024

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
Copy link
Contributor Author

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
Copy link

niteshagrawal commented Sep 5, 2024

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
Copy link

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?

@fkiDev
Copy link

fkiDev commented Sep 20, 2024

try this after doing patch suggested by niteshagrawal
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={ 60} style={{ flex: 1, }} >
<SafeAreaView style={{ flex: 1}}> <GiftedChat .... bottomOffset={1}/>

@niteshagrawal
Copy link

try this after doing patch suggested by niteshagrawal <KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={ 60} style={{ flex: 1, }} > <SafeAreaView style={{ flex: 1}}> <GiftedChat .... bottomOffset={1}/>

Thank you for extending my answer @fkiDev.
but instead of using behaviour as “padding” only which is mainly usable in ios, you can use
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}

also @nikita10001 please try this and let me know if you still same issue

@melyux
Copy link

melyux commented Oct 18, 2024

@niteshagrawal It works-ish, but the KeyboardAvoidingView stays around even when the keyboard is dismissed, on both Android and iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants