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

LongTextField does not have a "rows" prop #208

Closed
tab00 opened this issue Feb 28, 2017 · 6 comments
Closed

LongTextField does not have a "rows" prop #208

tab00 opened this issue Feb 28, 2017 · 6 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@tab00
Copy link
Contributor

tab00 commented Feb 28, 2017

LongTextField is meant to render as a textarea, i.e. a multi-row field for user text input. However the API does not have any prop to set the number of rows: https://github.com/vazco/uniforms/blob/10ef9ba2445f4d23051109ab0ac19ba48bc52038/API.md#longtextfield

How can we set the number of rows?

@janowsiany janowsiany self-assigned this Feb 28, 2017
@janowsiany
Copy link
Contributor

Hello @tab00 can you specify which package are you talking about?

@janowsiany janowsiany added the Type: Question Questions and other discussions label Feb 28, 2017
@tab00
Copy link
Contributor Author

tab00 commented Feb 28, 2017

I am using the uniforms-bootstrap4 theme, though is the theme actually relevant?

@janowsiany janowsiany added Type: Bug Bug reports and their fixes and removed Type: Question Questions and other discussions labels Feb 28, 2017
@janowsiany
Copy link
Contributor

janowsiany commented Feb 28, 2017

Components such as LongTextField are handled differently in each packages, specifically for the package like bootstrap4 or material-ui. However as you pointed rows property is not passed down to textarea input as you can see in the sources.
Would you like to handle rows property there and submit a PR?

@tab00
Copy link
Contributor Author

tab00 commented Feb 28, 2017

Would simply adding rows={props.rows} in the section that you have referred to fix it?:

const LongText = props =>
    wrapField(props, (
        <textarea
            className={classnames(props.inputClassName, 'form-control', {'form-control-danger': props.error})}
            disabled={props.disabled}
            id={props.id}
            name={props.name}
            onChange={event => props.onChange(event.target.value)}
            placeholder={props.placeholder}
            ref={props.inputRef}
            value={props.value}
            rows={props.rows}
        />
   ))

@janowsiany
Copy link
Contributor

It is that simple.

Don't bother if it will not work in demo app, i see now that it has some custom styles which should only refer to left panel. Make your PR anyway.

@radekmie
Copy link
Contributor

@janowsiany - use filterDOMProps instead of passing every prop. I'll try to cover it, but as always PRs are encouraged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

3 participants