Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow to pass minRows prop to MessageInput #2411

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ If provided, the existing message will be edited on submit.
| ------ |
| object |

### minRows

Min number of rows the underlying `textarea` will start with. The [`grow`](./#grow) on MessageInput prop has to be enabled for `minRows` to take effect.

| Type | Default |
| ------ | ------- |
| number | 1 |

### noFiles

If true, disables file uploads for all attachments except for those with type 'image'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ If true, expands the text input vertically for new lines.
Allows to hide MessageInput's send button. Used by `MessageSimple` to hide the send button in `EditMessageForm`.

| Type | Default |
|---------|---------|
| ------- | ------- |
| boolean | false |

### Input
Expand Down Expand Up @@ -171,6 +171,14 @@ If provided, the existing message will be edited on submit.
| ------ |
| object |

### minRows

Min number of rows the underlying `textarea` will start with. The [`grow`](./#grow) on MessageInput prop has to be enabled for `minRows` to take effect.

| Type | Default |
| ------ | ------- |
| number | 1 |

### noFiles

If true, disables file uploads for all attachments except for those with type 'image'.
Expand Down
1 change: 1 addition & 0 deletions src/components/ChatAutoComplete/ChatAutoComplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const UnMemoizedChatAutoComplete = <
loadingComponent={LoadingIndicator}
maxRows={messageInput.maxRows}
minChar={0}
minRows={messageInput.minRows}
onBlur={props.onBlur}
onChange={props.onChange || messageInput.handleChange}
onFocus={props.onFocus}
Expand Down
2 changes: 2 additions & 0 deletions src/components/MessageInput/MessageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export type MessageInputProps<
mentionQueryParams?: SearchQueryParams<StreamChatGenerics>['userFilters'];
/** If provided, the existing message will be edited on submit */
message?: StreamMessage<StreamChatGenerics>;
/** Min number of rows the underlying `textarea` will start with. The `grow` on MessageInput prop has to be enabled for `minRows` to take effect. */
minRows?: number;
/** If true, disables file uploads for all attachments except for those with type 'image'. Default: false */
noFiles?: boolean;
/** Function to override the default submit handler */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const useCreateMessageInputContext = <
mentioned_users,
mentionQueryParams,
message,
minRows,
noFiles,
numberOfUploads,
onPaste,
Expand Down Expand Up @@ -127,6 +128,7 @@ export const useCreateMessageInputContext = <
mentioned_users,
mentionQueryParams,
message,
minRows,
noFiles,
numberOfUploads,
onPaste,
Expand Down Expand Up @@ -172,6 +174,7 @@ export const useCreateMessageInputContext = <
isUploadEnabled,
linkPreviewsValue,
mentionedUsersLength,
minRows,
parentId,
publishTypingEvent,
recordingController,
Expand Down
Loading