-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(TextArea): Add autoResize #14860
feat(TextArea): Add autoResize #14860
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b93e4bb:
|
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Potential regressions comparing to master
Perf comparison
Perf tests with no regressions
|
@@ -44,9 +45,16 @@ export interface TextAreaProps extends UIComponentProps, ChildrenComponentProps | |||
|
|||
/** A textarea can take the width of its container. */ | |||
fluid?: boolean; | |||
|
|||
/** A textarea can be set to automatically adjust the height */ | |||
autoAdjustHeight?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I called it autoAdjustHeight
to be similar to Fabric and it was also as the user named it when requiring it.... But I wonder if autoResize
wouldn't be a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would vote for autoResize
it's what I would search for if I need behavior like this.
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 12e72defeec4e1c2a6c7326c9cef670f6c2b2a55 (build) |
packages/fluentui/react-northstar/src/themes/teams/components/TextArea/textAreaStyles.ts
Outdated
Show resolved
Hide resolved
packages/fluentui/react-northstar/src/themes/teams/components/TextArea/textAreaStyles.ts
Outdated
Show resolved
Hide resolved
Hello @assuncaocharles! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
inputRef.current.style.height = '0'; | ||
inputRef.current.style.height = `${inputRef.current?.scrollHeight}px`; | ||
} | ||
}, [inputRef.current?.scrollHeight, autoResize]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the first render inputRef.current.scrollHeight
will be null. In general it's incorrect to use such things as effect dependencies
|
This reverts commit cf13453.
#### Pull request checklist - [ ] Addresses an existing issue: Fixes #0000 - [ ] Include a change request file using `$ yarn change` #### Description of changes This PR adds the ability for `TextArea` to auto adjust the height based in the content ![cAUtPGDi1P](https://user-images.githubusercontent.com/8545105/91996646-86e08000-ed39-11ea-8aaa-1197bc4204da.gif) #### Focus areas to test (optional)
…osoft#14878) This reverts commit cf13453.
Pull request checklist
$ yarn change
Description of changes
This PR adds the ability for
TextArea
to auto adjust the height based in the contentFocus areas to test
(optional)