Skip to content

Commit

Permalink
fix(antd): add helperContainer to antd array-items (#3780)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxianxi authored Apr 10, 2023
1 parent f8c2040 commit 757b466
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/antd/src/array-items/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useRef } from 'react'
import { ArrayField } from '@formily/core'
import {
useField,
Expand Down Expand Up @@ -74,6 +74,7 @@ const useAddition = () => {
export const ArrayItems: ComposedArrayItems = observer((props) => {
const field = useField<ArrayField>()
const prefixCls = usePrefixCls('formily-array-items')
const ref = useRef<HTMLDivElement>(null)
const schema = useFieldSchema()
const addition = useAddition()
const dataSource = Array.isArray(field.value) ? field.value : []
Expand All @@ -89,13 +90,17 @@ export const ArrayItems: ComposedArrayItems = observer((props) => {
>
<div
{...props}
ref={ref}
onChange={() => {}}
className={cls(prefixCls, props.className)}
>
<SortableList
useDragHandle
lockAxis="y"
helperClass={`${prefixCls}-sort-helper`}
helperContainer={() =>
ref.current?.querySelector(`${prefixCls}-list`)

This comment has been minimized.

Copy link
@weishaodaren

weishaodaren Apr 20, 2023

- ref.current?.querySelector(`${prefixCls}-list`)
+ ref.current?.querySelector(`.${prefixCls}-list`)
}
onSortEnd={({ oldIndex, newIndex }) => {
field.move(oldIndex, newIndex)
}}
Expand Down

1 comment on commit 757b466

@weishaodaren
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

导致拖拽异常

Please sign in to comment.