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

TextArea autoHeight initialState with SSR #1478

Closed
lokhmakov opened this issue Mar 19, 2017 · 3 comments
Closed

TextArea autoHeight initialState with SSR #1478

lokhmakov opened this issue Mar 19, 2017 · 3 comments

Comments

@lokhmakov
Copy link

With server side render (SSR) TextArea does not set init styles and showed full sized before scripts started.

http://imgur.com/a/IgjYt

I use some hack:

<TextArea
  style={ description === `` ? {  minHeight: 0, resize: `none`, height: `41px` } : {} }
  autoHeight
/>

But think we can do it inside TextArea.

@levithomason
Copy link
Member

Thanks @lokhmakov.

We have to wait for one render in order to measure the textarea and size it. We should likely apply the minimum height style on the first render to prevent this issue. We may need to remove the style when making the measurement to ensure the content can size the textarea.

@lokhmakov
Copy link
Author

If we cannot determine initial height then we can set initial rows, like this:

  rows={ value === `` ? 1 : null }

@levithomason
Copy link
Member

Closing for housekeeping as there isn't much activity over here. We're open to a PR on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants