@@ -13,6 +13,7 @@ import Notification, {
1313import useListPosition from './hooks/useListPosition' ;
1414import useListScroll from './hooks/useListScroll' ;
1515import useStack from './hooks/useStack' ;
16+ import { composeRef } from '@rc-component/util/lib/ref' ;
1617
1718export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' ;
1819export type { StackConfig } from './interface' ;
@@ -165,29 +166,21 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
165166 const { key, placement : _placement , ...notificationConfig } = config ;
166167 const strKey = String ( key ) ;
167168
169+ const setItemRef = ( node : HTMLDivElement | null ) => {
170+ setNodeSize ( strKey , node ) ;
171+ } ;
172+
168173 return (
169174 < div
170- key = { key }
171- className = { clsx (
172- noticeWrapperCls ,
173- itemPrefixCls ,
174- motionClassName ,
175- classNames ?. wrapper ,
176- config . classNames ?. wrapper ,
177- ) }
178- ref = { ( node ) => {
179- assignRef ( nodeRef , node ) ;
180- setNodeSize ( strKey , node ) ;
181- } }
175+ className = { clsx ( noticeWrapperCls , itemPrefixCls , motionClassName ) }
182176 style = { {
183177 ...motionStyle ,
184- ...styles ?. wrapper ,
185- ...config . styles ?. wrapper ,
186178 } }
187179 >
188180 < Notification
189- key = { config . times }
181+ key = { key }
190182 { ...notificationConfig }
183+ ref = { composeRef ( nodeRef , setItemRef ) }
191184 prefixCls = { prefixCls }
192185 offset = { notificationPosition . get ( strKey ) }
193186 className = { clsx ( contextClassNames ?. notice , config . className ) }
0 commit comments