1

I am making a react native application using expo and am using react-native-gifted-chat for a chat like feature (https://github.com/FaridSafi/react-native-gifted-chat). In this feature, I only want certain users to be able to send a message. The users who cant should only be able to view the messages that have been sent.

In order to implement this, I need a way to hide the keyboard/text input for the users who are not authorized to send a message. I was reading through the documentation and am unsure of how to do this. Is there a way to hide the keyboard/text input and only load the messages?

Not sure if this is relevant but my code for the gifted chat is as follows:

<GiftedChat
      messages={this.state.messages}
      placeholder="Send your thoughts?"
      onSend={(messages) => this.sendMessage(messages)}
      user={{
        ...user details
      }}
/>

Thanks!

Questions123
  • 372
  • 2
  • 6
  • 18

2 Answers2

2

Just pass null for the prop renderInputToolbar:

<GiftedChat
    ...
    renderInputToolbar={() => { return null }}
/>
dansiemens
  • 530
  • 1
  • 4
  • 12
0

Set the minInputToolbarHeight attribute to zero:

<GiftedChat
    ...
    minInputToolbarHeight=0
/>
ib.
  • 27,830
  • 11
  • 80
  • 100