0

I'm using the react-native-gifted-chat package for my React Native application. Somehow there is a space between the composer and the keyboard, although I did not customise the GiftedChat.

Marked orange in the attached screenshot:

enter image description here

I already tried to customise the composer or any other component, with not effect.

Mario Murrent
  • 712
  • 5
  • 24

3 Answers3

1

i'm also facing same problem after some time i find this solution and it's work for me.

     <GiftedChat
                    isAnimated
                    messages={this.state.messages}
                    scrollToBottom={true}
                    renderUsernameOnMessage={true}
                    onSend={messages => this.onSend(messages)}
                    inverted={false}
                    isLoadingEarlier={true}
                    messagesContainerStyle={{ color: 'gray' }}
                    bottomOffset={0} // add this line and space is remove
                    renderBubble={props => {
                        return (
                            <Bubble
                                {...props}

                                textStyle={{
                                    right: {
                                        color: 'white',
                                    },
                                    left: {
                                        color: '#24204F',
                                    },
                                }}
                                wrapperStyle={{
                                    left: {
                                        backgroundColor: 'white',
                                    },
                                    right: {
                                        backgroundColor: "#ff3b00", // red
                                    },
                                }}
                            />
                        );
                    }}
                    renderInputToolbar={props => {
                        return (<InputToolbar {...props} containerStyle={{ backgroundColor: '#e2e2e2' }} />);
                    }}
                    user={{
                        _id: 1
                    }}
                />

hope this willl work for you bottomOffset={0} // add this line and space is remove

Vipin Pareek
  • 236
  • 2
  • 10
0

install react-native-iphone-x-helper

and add these lines according to your code.

import { getBottomSpace } from 'react-native-iphone-x-helper';



<GiftedChat 
    bottomOffset={getBottomSpace()}
    ...
/>
0

As found on the docs itself, simply get the insets:

const insets = useSafeAreaInsets();
<GiftedChat
   bottomOffset={insets.bottom}
   ...
 />

This will fix your issue dynamically.