Export BaseFieldProps

This commit is contained in:
doomsower
2017-10-22 11:17:41 +03:00
parent ed36d5538f
commit 44f2375b73
2 changed files with 12 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ interface CommonFieldProps {
onFocus: EventHandler<FocusEvent<any>>;
}
interface BaseFieldProps<P = {}> extends Partial<CommonFieldProps> {
export interface BaseFieldProps<P = {}> extends Partial<CommonFieldProps> {
name: string;
component?: ComponentType<P> | "input" | "select" | "textarea",
format?: Formatter | null;

View File

@@ -11,6 +11,7 @@ import {
formValueSelector,
Field,
GenericField,
BaseFieldProps,
WrappedFieldProps,
Fields,
GenericFields,
@@ -125,6 +126,11 @@ const MyField: StatelessComponent<MyFieldProps> = ({
};
const FieldCustom = Field as new () => GenericField<MyFieldCustomProps>;
type FieldProps = BaseFieldProps<MyFieldCustomProps> & MyFieldCustomProps;
const FieldCustomComp: StatelessComponent<FieldProps> = props => (
<FieldCustom {...props} component={MyField} />
)
const MyFieldImm: StatelessComponent<MyFieldProps> = ({
children,
input,
@@ -262,6 +268,11 @@ const Test = reduxForm({
foo="bar"
/>
<FieldCustomComp
name="field_4_comp"
foo="bar"
/>
<FieldImmutableCustom
name="field4"
component={ MyField }