Skip to content

Commit e365bc6

Browse files
committed
fix: list nest list
1 parent 82f898e commit e365bc6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Field.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ class Field extends React.Component<InternalFieldProps, FieldState> implements F
627627
function WrapperField<Values = any>({ name, ...restProps }: FieldProps<Values>) {
628628
const fieldContext = React.useContext(FieldContext);
629629
const listContext = React.useContext(ListContext);
630-
const mergedIsListField = restProps.isListField || (!restProps.isList && !!listContext);
631630
const namePath = name !== undefined ? getNamePath(name) : undefined;
632631

633632
let key: string = 'keep';
@@ -650,7 +649,7 @@ function WrapperField<Values = any>({ name, ...restProps }: FieldProps<Values>)
650649
<Field
651650
key={key}
652651
name={namePath}
653-
isListField={mergedIsListField}
652+
isListField={!!listContext}
654653
{...restProps}
655654
fieldContext={fieldContext}
656655
/>

src/List.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const List: React.FunctionComponent<ListProps> = ({
3939
validateTrigger,
4040
}) => {
4141
const context = React.useContext(FieldContext);
42+
const wrapperListContext = React.useContext(ListContext);
4243
const keyRef = React.useRef({
4344
keys: [],
4445
id: 0,
@@ -87,6 +88,7 @@ const List: React.FunctionComponent<ListProps> = ({
8788
validateTrigger={validateTrigger}
8889
initialValue={initialValue}
8990
isList
91+
isListField={!!wrapperListContext}
9092
>
9193
{({ value = [], onChange }, meta) => {
9294
const { getFieldValue } = context;

0 commit comments

Comments
 (0)