-
Notifications
You must be signed in to change notification settings - Fork 2
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
Enhance <TextInputRow> for custom rendering and textarea autosizing #203
Conversation
packages/form/src/TextInputRow.js
Outdated
{...sharedProps} | ||
{...inputProps} /> | ||
return React.createElement( | ||
isFunction(inputComponent) ? inputComponent : 'input', |
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.
Maybe you can just set default value of 'input'
to props.inputComponent
? And allow it to be either a String or a Function.
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.
Sounds great!
{...sharedProps} | ||
{...inputProps} /> | ||
); | ||
if (isFunction(renderInput)) { |
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.
What if it's used this way:
<TextInputRow
multiLine
renderInput={func}
/>
Do you intent to let renderInput
overridden by multiLine
?
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.
No, input can't be customized when multiLine
mode.
expect(controlledWrapper.find('textarea').prop('style')).toEqual({ height: 60 }); | ||
const textareaWrapper = uncontrolledWrapper.find(AutoSizeTextarea); | ||
expect(textareaWrapper.exists()).toBeTruthy(); | ||
expect(textareaWrapper.props()).toMatchObject({ minRows: 5, maxRows: 10 }); |
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.
👍 nice shallow testing
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.
Others look great to me 💯
Purpose
Enhance
<TextInputRow>
for custom rendering and textarea autosizing.Changes
Changed
<TextInputRow>
:renderInput
orinputComponent
prop.minRows
andmaxRows
props.Risk
none.
TODOs
none.