diff --git a/components/float-button/FloatButtonGroup.tsx b/components/float-button/FloatButtonGroup.tsx index ba41255b23..241f7914e8 100644 --- a/components/float-button/FloatButtonGroup.tsx +++ b/components/float-button/FloatButtonGroup.tsx @@ -1,12 +1,13 @@ -import React, { useRef, memo, useContext, useEffect, useCallback, useMemo } from 'react'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import FileTextOutlined from '@ant-design/icons/FileTextOutlined'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import FloatButton, { floatButtonPrefixCls } from './FloatButton'; +import React, { memo, useCallback, useContext, useEffect, useMemo, useRef } from 'react'; +import warning from '../_util/warning'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; +import FloatButton, { floatButtonPrefixCls } from './FloatButton'; import { FloatButtonGroupProvider } from './context'; import type { FloatButtonGroupProps } from './interface'; import useStyle from './style'; @@ -88,6 +89,15 @@ const FloatButtonGroup: React.FC = (props) => { } }, [trigger]); + // =================== Warning ===================== + if (process.env.NODE_ENV !== 'production') { + warning( + typeof props.open !== 'boolean' || !!trigger, + 'FloatButton.Group', + '`open` need to be used together with `trigger`', + ); + } + return wrapSSR(
diff --git a/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap index 3404593ff8..8e9c5799a2 100644 --- a/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -660,6 +660,220 @@ exports[`renders components/float-button/demo/basic.tsx extend context correctly `; +exports[`renders components/float-button/demo/controlled.tsx extend context correctly 1`] = ` +Array [ +
+
+ + +
+ +
, + , +] +`; + exports[`renders components/float-button/demo/description.tsx extend context correctly 1`] = ` Array [ + +
+ + , + , +] +`; + exports[`renders components/float-button/demo/description.tsx correctly 1`] = ` Array [