Repository URL to install this package:
|
Version:
3.1.1 ▾
|
import * as React from 'react'
import { observer } from 'xmobx/mobx-react'
import { errorMessageFor, isValid } from '../../validators'
import { InputProps } from '../inputs'
import { InputState } from '../inputs/InputState'
import { Value } from '../typings'
@observer
export class TextAreaPlugin extends React.Component<InputProps> {
static isSatisfiedByProps(props: { type: string }): boolean {
return ['textarea'].includes(props.type)
}
static defaultState = (inputState: InputState) => {
return {
validator: (value: Value) =>
isValid(value as string) || errorMessageFor('required'),
}
}
render() {
const { ref, className, ...props } = this.props
return <textarea className={className} {...props} />
}
}