fix: apply field condition to custom components (#560)

This commit is contained in:
Dan Ribbens
2022-05-11 19:43:53 -04:00
committed by GitHub
parent afb158fb50
commit 1dfe2b8929
4 changed files with 42 additions and 2 deletions

View File

@@ -1,12 +1,14 @@
import React from 'react';
import { Props } from './types';
import withCondition from '../../forms/withCondition';
const RenderCustomComponent: React.FC<Props> = (props) => {
const { CustomComponent, DefaultComponent, componentProps } = props;
if (CustomComponent) {
const ConditionalCustomComponent = withCondition(CustomComponent);
return (
<CustomComponent {...componentProps} />
<ConditionalCustomComponent {...componentProps} />
);
}