FaridSafi / react-native-gifted-chat

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

Page and text input jumps up then falls down upon opening keyboard, IOS #2222

Open JoshuaWeissTBS opened 2 years ago

JoshuaWeissTBS commented 2 years ago

Issue Description

When you open the keyboard, the text input pushes the whole page up for a second, then it falls back down on top of the keyboard. This doesn't always happen, usually on the first time you open the page after it is rendered, it works as expected, and every time after, it doesn't work. Sometimes it doesn't work on the first try anyway.

doing isKeyboardHandled={false} fixes the jump/bounce, but adds a new issue, the page gets pushed up, (even an absolute value View), and stays there, hiding components out of sight.

Steps to Reproduce / Code Snippets

(Inside function component) In page component:

return (
    <View style={{
      flex: 1,
    }}>
      <View style={{
        height: heightPercentageToDP(10),
        width: "100%",
        backgroundColor: 'blue',
      }}>
      </View>
      <GiftedChat
        messages={messages}
        messagesContainerStyle={{
          backgroundColor: 'green',
        }}
        wrapInSafeArea={false}
      />
    </View>
  )

In stack navigator (the bounce/jump issue happens regardless, however the navigator has interactions with the way the text input moves):

<Tab.Screen
  {...}
  options={{
    tabBarHideOnKeyboard: true,
    {...}
  }}
  />

Expected Results

Keyboard and text input should move up together when you open the keyboard, and the text input should not push up the entire page and then jump back down a second later.

Additional Information

ArnabXD commented 2 years ago

I am having the same issue

hungtd97 commented 1 year ago

The same issue when I have another input (in modal for example). When I press the second input, the same behavior appears. This is my question on Stackoverflow: https://stackoverflow.com/questions/75104617/react-native-gifted-chat-cant-show-keyboard-when-have-other-text-input-in-same