Skip to content

Commit cb94730

Browse files
authored
chore(FormTextArea): use React.forwardRef() (#4405)
1 parent 1796beb commit cb94730

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/collections/Form/FormTextArea.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import FormField from './FormField'
1010
* @see Form
1111
* @see TextArea
1212
*/
13-
function FormTextArea(props) {
13+
const FormTextArea = React.forwardRef(function (props, ref) {
1414
const { control } = props
1515
const rest = getUnhandledProps(FormTextArea, props)
1616
const ElementType = getElementType(FormTextArea, props)
1717

18-
return <ElementType {...rest} control={control} />
19-
}
18+
return <ElementType {...rest} control={control} ref={ref} />
19+
})
2020

21+
FormTextArea.displayName = 'FormTextArea'
2122
FormTextArea.propTypes = {
2223
/** An element type to render as (string or function). */
2324
as: PropTypes.elementType,

test/specs/collections/Form/FormTextArea-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as common from 'test/specs/commonTests'
66

77
describe('FormTextArea', () => {
88
common.isConformant(FormTextArea)
9+
common.forwardsRef(FormTextArea, { tagName: 'textarea' })
910
common.labelImplementsHtmlForProp(FormTextArea)
1011

1112
it('renders a FormField with a TextArea control', () => {

0 commit comments

Comments
 (0)