Closed ArneMis closed 5 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
any progress?
anyone having the same problem, this seems to fix it
When rendering a Giftedchat component with text property linked to a local state will result in the clearing of the state value when rendering for the first time.
create a component which includes giftedchat in the render method:
constructor(props, context) { super(props, context); this.state = { message:"test" }; }
setCustomText = (newMessage) => { this.setState({ ...this.state, message:newMessage }); }
.... <GiftedChat text={this.state.message} onInputTextChanged={(text) => this.setCustomText(text)} ... /> ...
When we put a default message text in the giftedchat, it is overwritten when rendered for the first time. I think the issue is related to the "notifyInputTextReset" function who resets the inputText and passes it to the onInputTextChanged.
If we do not include the onInputTextChanged method, we are unable to type in the inputbox.
Expected Results
Able to put a default message in the inputText linked the prop "text".
Additional Information