3

Is it possible to disable the text input including the send button completely for the react-native-gifted-chat component?

This is my current component:

<GiftedChat text={emergencyText} onInputTextChanged={this.setEmergencyText} />

I could override the render methods, but how do I then render the original input?

Mario Murrent
  • 712
  • 5
  • 24

2 Answers2

2

You can use the disableComposer prop.

<GiftedChat disableComposer={true}  text={emergencyText} onInputTextChanged={this.setEmergencyText} />
alpere
  • 1,079
  • 17
  • 26
1

Since React-native-gifted-chat does not have the disable props for it provides one more component, that is InputToolbar, if we render null value to we can almost disable the sending feature. just try the below code.

  <InputToolbar
    render={null}
    text={emergencyText} 
    onInputTextChanged={this.setEmergencyText}
  />

It serves your purpose.

Deepak N
  • 1,408
  • 3
  • 15
  • 37