uniforms-react-semantic
Version:
Semantic React UI components for uniforms.
59 lines (45 loc) • 1.44 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types'
import connectField from 'uniforms/connectField';
import {TextArea} from 'semantic-ui-react'
import filterSemanticProps from "./filterSemanticProps";
import Wrapper from "./Wrapper";
const LongText = ({
as,
autoHeight,
onChange,
rows,
style,
value,
label,
error,
errorMessage,
showInlineError,
...props,
}) => (
<Wrapper showInlineError={showInlineError} errorMessage={errorMessage} error={error} label={label}>
<TextArea
{...filterSemanticProps(props)}
as={as}
autoHeight={autoHeight}
rows={rows}
style={style}
value={value || ''}
onChange={(event, {value = ''}) => {
onChange(value)
}}
/>
</Wrapper>
)
LongText.propTypes = {
errorMessage: PropTypes.string,
showInlineError: PropTypes.bool,
errorLabel: PropTypes.element,
...TextArea.propTypes,
error: PropTypes.object,
}
export default connectField(LongText, {
includeInChain: false,
ensureValue: true,
initialValue: true,
});