diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 9ba5c27dcf..63f801d352 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -6,6 +6,7 @@ import type { CSSMotionProps } from 'rc-motion'; import type { BasicDataNode, TreeProps as RcTreeProps } from 'rc-tree'; import RcTree from 'rc-tree'; import type { DataNode, Key } from 'rc-tree/lib/interface'; +import DisabledContext from '../config-provider/DisabledContext'; import initCollapseMotion from '../_util/motion'; import { ConfigContext } from '../config-provider'; @@ -172,11 +173,16 @@ const Tree = React.forwardRef((props, ref) => { draggable, motion: customMotion, style, + disabled: customDisabled, } = props; const prefixCls = getPrefixCls('tree', customizePrefixCls); const rootPrefixCls = getPrefixCls(); + // ===================== Disabled ===================== + const disabled = React.useContext(DisabledContext); + const mergedDisabled = customDisabled ?? disabled; + const motion: CSSMotionProps = customMotion ?? { ...initCollapseMotion(rootPrefixCls), motionAppear: false, @@ -191,6 +197,7 @@ const Tree = React.forwardRef((props, ref) => { blockNode, showLine: Boolean(showLine), dropIndicatorRender, + disabled: mergedDisabled, }; const [wrapSSR, hashId] = useStyle(prefixCls);