Skip to content

Commit b0686d1

Browse files
committed
fix: List should also support isFieldList
1 parent d9c68c1 commit b0686d1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/List.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export interface ListProps {
2929
operations: ListOperations,
3030
meta: Meta,
3131
) => JSX.Element | React.ReactNode;
32+
33+
/** @private Passed by Form.List props. Do not use since it will break by path check. */
34+
isListField?: boolean;
3235
}
3336

3437
const List: React.FunctionComponent<ListProps> = ({
@@ -37,6 +40,7 @@ const List: React.FunctionComponent<ListProps> = ({
3740
children,
3841
rules,
3942
validateTrigger,
43+
isListField,
4044
}) => {
4145
const context = React.useContext(FieldContext);
4246
const keyRef = React.useRef({
@@ -87,6 +91,7 @@ const List: React.FunctionComponent<ListProps> = ({
8791
validateTrigger={validateTrigger}
8892
initialValue={initialValue}
8993
isList
94+
isListField={isListField}
9095
>
9196
{({ value = [], onChange }, meta) => {
9297
const { getFieldValue } = context;

tests/preserve.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ describe('Form.Preserve', () => {
421421
remove(field.name);
422422
}}
423423
/>
424-
<Form.List name={[field.name]}>
424+
<Form.List {...field} name={[field.name]}>
425425
{childFields =>
426426
childFields.map(childField => (
427427
<div key={childField.key}>

0 commit comments

Comments
 (0)