Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable the text input in react-native-gifted-chat

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?

like image 742
Mario Murrent Avatar asked Dec 11 '25 15:12

Mario Murrent


2 Answers

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.

like image 61
Deepak N Avatar answered Dec 13 '25 03:12

Deepak N


You can use the disableComposer prop.

<GiftedChat disableComposer={true}  text={emergencyText} onInputTextChanged={this.setEmergencyText} />
like image 35
alpere Avatar answered Dec 13 '25 05:12

alpere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!