Search code examples
react-native-gifted-chat

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?


Solution

  • 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.