11import { CSSMotionList } from '@rc-component/motion' ;
22import type { CSSMotionProps } from '@rc-component/motion' ;
3+ import { composeRef } from '@rc-component/util/lib/ref' ;
34import { clsx } from 'clsx' ;
45import * as React from 'react' ;
5- import type { StackConfig } from './interface' ;
6- import { NotificationContext } from './legacy/NotificationProvider' ;
6+ import useListPosition from '../hooks/useListPosition' ;
7+ import useStack from '../hooks/useStack' ;
8+ import type { StackConfig } from '../interface' ;
9+ import { NotificationContext } from '../legacy/NotificationProvider' ;
710import Notification , {
811 type ComponentsType ,
912 type NotificationClassNames ,
1013 type NotificationProps ,
1114 type NotificationStyles ,
12- } from './Notification' ;
13- import useListPosition from './hooks/useListPosition' ;
14- import useStack from './hooks/useStack' ;
15- import { composeRef } from '@rc-component/util/lib/ref' ;
15+ } from '../Notification' ;
16+ import Content from './Content' ;
1617
1718export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' ;
18- export type { StackConfig } from './interface' ;
19+ export type { StackConfig } from '.. /interface' ;
1920
2021export interface NotificationListConfig extends Omit < NotificationProps , 'prefixCls' > {
2122 key : React . Key ;
@@ -94,6 +95,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
9495 stackPosition ,
9596 gap ,
9697 ) ;
98+ const hasConfigList = ! ! configList . length ;
9799
98100 React . useEffect ( ( ) => {
99101 const listNode = contentRef . current ;
@@ -106,7 +108,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
106108 const nextGap = parseFloat ( rowGap || cssGap ) || 0 ;
107109
108110 setGap ( ( prevGap ) => ( prevGap === nextGap ? prevGap : nextGap ) ) ;
109- } , [ ! ! configList . length ] ) ;
111+ } , [ hasConfigList ] ) ;
110112
111113 // ========================= Render =========================
112114 const listPrefixCls = `${ prefixCls } -list` ;
@@ -132,13 +134,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
132134 } }
133135 style = { style }
134136 >
135- < div
136- className = { `${ listPrefixCls } -content` }
137- style = { {
138- height : totalHeight ,
139- } }
140- ref = { contentRef }
141- >
137+ < Content listPrefixCls = { listPrefixCls } height = { totalHeight } ref = { contentRef } >
142138 < CSSMotionList
143139 component = { false }
144140 keys = { keys }
@@ -220,10 +216,10 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
220216 ) ;
221217 } }
222218 </ CSSMotionList >
223- </ div >
219+ </ Content >
224220 </ div >
225221 ) ;
226222} ;
227223
228224export default NotificationList ;
229- export type { NotificationClassNames , NotificationStyles } from './Notification' ;
225+ export type { NotificationClassNames , NotificationStyles } from '.. /Notification' ;
0 commit comments