React-native-gifted-chat: How to completely hide text input

Created on 27 Mar 2017  路  6Comments  路  Source: FaridSafi/react-native-gifted-chat

Issue Description

Is there a way to completely hide the text input that appears at the bottom of GiftedChat? I have a use case where messages are generated automatically by the server and I want to display these messages using GiftedChat, but a user of the app cannot create any new messages. So I want to completely hide the text input, i.e. not render <InputToolbar> at all, and there should be no way for a user to activate the keyboard etc.

I thought I might have been able to use the renderInputToolbar() prop to achieve this by doing renderInputToolbar={() => null}. While this does cause <InputToolbar> to not be rendered, it leaves a blank space where the <InputToolbar> would have been rendered and I can't seem to find a way to get the <MessageContainer> to fill this blank space.

Additional Information

  • React Native version: 0.41.2
  • react-native-gifted-chat version: 0.1.3
  • Platform(s) (iOS, Android, or both?): Both

Most helpful comment

Hello,

renderInputToolbar={() => null}
renderComposer={() => null}
minInputToolbarHeight={0}

is working fine for me !

All 6 comments

@jordanmkoncz try renderComposer

@kfiroo I tried doing renderComposer={() => null}, and while this does mean that the composer is no longer rendered, I still have the same issue as the <InputToolbar> is still rendered and taking up space, it just doesn't have the composer rendered inside of it.

@jordanmkoncz The issue is that the message container always accounts for the input height, regardless if it visible or not:
https://github.com/FaridSafi/react-native-gifted-chat/blob/master/src/GiftedChat.js#L322

@Cederman Yep that's what I found while experimenting with different options for trying to hide the text input. Any suggestions on how I could achieve this?

Hello,

renderInputToolbar={() => null}
renderComposer={() => null}
minInputToolbarHeight={0}

is working fine for me !

If you miss any of the steps then you are doomed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arayaryoma picture arayaryoma  路  3Comments

cerberusv2px picture cerberusv2px  路  3Comments

emilkarl picture emilkarl  路  3Comments

jasonwcfan picture jasonwcfan  路  3Comments

redwind picture redwind  路  3Comments