I'm referencing the code that is here:
https://snack.expo.io/@xcarpentier/gifted-chat
As the code stands, when someone press on:
#awesome
an alert will trigger due to:
onPress: props => alert(`press on ${props}`),
What I would like to do is have the press send 'Hello world' into the input as if the user had simply typed in the message and then press enter.
It seems I would need to send 'Hello world' into this function:
onSend(messages = []) {
this.setState((previousState) => ({
messages: GiftedChat.append(previousState.messages, messages),
}));
}
but I'm not sure how to do this.
How would I get the press to function like an ordinary chat input?
You can achieve the functionality without needing to simulate a button press: