How to configure gift-chat to send message when enter key is pressed?

how to solve this issue when
i have to click on enter from system keyboard then message are not send

is it possible to
when keypress enter = send message
When keypress shift + enter = new line message

  • Nodejs version: latest
  • React version: 0.1.0
  • React Native version: latest
  • react-native-gifted-chat version: “0.10.0-beta.web.26
  • TypeScript version: 3.6.3

1 possible answer(s) on “How to configure gift-chat to send message when enter key is pressed?

  1. Here’s what I did:

    export const ChatComposer = (
      props: ComposerProps & {
        // GiftedChat passes its props to all of its `render*()`
        onSend: SendProps<IMessage>['onSend'];
        text: SendProps<IMessage>['text'];
      },
    ) => (
      <Composer
        {...props}
        textInputProps={{
          ...props.textInputProps,
          // for enabling the Return key to send a message only on web
          blurOnSubmit: Platform.OS === 'web',
          onSubmitEditing:
            Platform.OS === 'web'
              ? () => {
                  if (props.text && props.onSend) {
                    props.onSend({text: props.text.trim()}, true);
                  }
                }
              : undefined,
        }}
      />
    );