react-native-gifted-chat icon indicating copy to clipboard operation
react-native-gifted-chat copied to clipboard

Gifted Chat UI - Height issue on ios

Open taatiq882 opened this issue 2 years ago • 6 comments

Issue Description

On Android, it's working but on ios, the Gifted chat is taking the full available heigh. As it can be seen it's not calculating heigh properly. When Header is disabled then it works fine but as soon I enable Header, some sort of padding or height issue comes. This doesn't happen on Android.

ON IOS with Header Enabled (Native Stack Navigator V6) Screen Shot 2022-06-12 at 8 47 36 PM

taatiq882 avatar Jun 12 '22 16:06 taatiq882

I came across this problem too, and I think that's because this library tries to place SafeArea for you by default :(. It's not documented, but there is a wrapInSafearea property which I set to false since I am already taking care of the SafeArea myself.

<GiftedChat wrapInSafeArea={false} ....

amerikan avatar Jun 13 '22 00:06 amerikan

Thanks. It solved the problem 🙌🏾

taatiq882 avatar Jun 13 '22 08:06 taatiq882

Thank you!! Solved the issue.

chakafasano88 avatar Jul 01 '22 19:07 chakafasano88

Works for me. Still having some funkiness with the textinput and safearea

julian-hecker avatar Aug 01 '22 00:08 julian-hecker

Works for me. Still having some funkiness with the textinput and safearea

I think that funkiness with the textinput and safearea seems like my problem => message going below textinput. Do you have the same problem? Have you solve it?

ori9998 avatar Aug 04 '22 23:08 ori9998

create a custom header

const RoomHeader = styled.View(() => ({
  position: 'absolute',
  width: '100%',
  height: 50,
  backgroundColor: 'gray',
  top: getStatusBarHeight(),
}));
    <Container>
      <RoomHeader />

      <View style={{ paddingTop: 50, flex: 1 }}>
        <GiftedChat
          alignTop
          messages={messages}
          onSend={(messages) => onSend(messages)}
          user={{
            _id: 1,
          }}
          bottomOffset={bottom === 0 ? 0 : bottom}
        />
      </View>
    </Container>

jwAndroid avatar Aug 29 '22 03:08 jwAndroid

workaround:

import { SafeAreaView } from 'react-native-safe-area-context';

<SafeAreaView edges={['right', 'bottom', 'left']} style={{ flex: 1 }}>
    <GiftedChat
        wrapInSafeArea={false}

zivgit avatar Sep 30 '22 08:09 zivgit

I came across this problem too, and I think that's because this library tries to place SafeArea for you by default :(. It's not documented, but there is a wrapInSafearea property which I set to false since I am already taking care of the SafeArea myself.

<GiftedChat wrapInSafeArea={false} ....

First of all, thank you for great work :) In the other hand it would be nice if this would be documented at least in the Troubleshooting section of README.md 😄

a-vikor avatar Dec 28 '22 16:12 a-vikor

Update: you can now update to v2.0.0 which finally removes SafeArea from the library, so this will not be an issue.

amerikan avatar Mar 13 '23 17:03 amerikan

I met the same problem. I have solved it, but not in the way that add "wrapInSafeArea={false}".
The version i used has no the property.

I tried import the SafeAreaView from "react-native" rather than "react-native-safe-area-context". And then it works, the problem has gone away

fayhot avatar Feb 01 '24 16:02 fayhot