@@ -45,13 +45,13 @@ const NoticeList: FC<NoticeListProps> = (props) => {
4545
4646  const  {  classNames : ctxCls  }  =  useContext ( NotificationContext ) ; 
4747
48-   const  dictRef  =  useRef < Record < React . Key ,  HTMLDivElement > > ( { } ) ; 
48+   const  dictRef  =  useRef < Record < string ,  HTMLDivElement > > ( { } ) ; 
4949  const  [ latestNotice ,  setLatestNotice ]  =  useState < HTMLDivElement > ( null ) ; 
50-   const  [ hoverKeys ,  setHoverKeys ]  =  useState < React . Key [ ] > ( [ ] ) ; 
50+   const  [ hoverKeys ,  setHoverKeys ]  =  useState < string [ ] > ( [ ] ) ; 
5151
5252  const  keys  =  configList . map ( ( config )  =>  ( { 
5353    config, 
54-     key : config . key , 
54+     key : String ( config . key ) , 
5555  } ) ) ; 
5656
5757  const  [ stack ,  {  offset,  threshold,  gap } ]  =  useStack ( stackConfig ) ; 
@@ -96,8 +96,15 @@ const NoticeList: FC<NoticeListProps> = (props) => {
9696        nodeRef , 
9797      )  =>  { 
9898        const  {  key,  times }  =  config  as  InnerOpenConfig ; 
99-         const  {  className : configClassName ,  style : configStyle  }  =  config  as  NoticeConfig ; 
100-         const  dataIndex  =  keys . findIndex ( ( item )  =>  item . key  ===  key ) ; 
99+         const  strKey  =  String ( key ) ; 
100+         const  { 
101+           className : configClassName , 
102+           style : configStyle , 
103+           classNames : configClassNames , 
104+           styles : configStyles , 
105+           ...restConfig 
106+         }  =  config  as  NoticeConfig ; 
107+         const  dataIndex  =  keys . findIndex ( ( item )  =>  item . key  ===  strKey ) ; 
101108
102109        // If dataIndex is -1, that means this notice has been removed in data, but still in dom 
103110        // Should minus (motionIndex - 1) to get the correct index because keys.length is not the same as dom length 
@@ -107,7 +114,7 @@ const NoticeList: FC<NoticeListProps> = (props) => {
107114          const  transformX  =  placement  ===  'top'  ||  placement  ===  'bottom'  ? '-50%'  : '0' ; 
108115          if  ( index  >  0 )  { 
109116            stackStyle . height  =  expanded 
110-               ? dictRef . current [ key ] ?. offsetHeight 
117+               ? dictRef . current [ strKey ] ?. offsetHeight 
111118              : latestNotice ?. offsetHeight ; 
112119
113120            // Transform 
@@ -119,9 +126,9 @@ const NoticeList: FC<NoticeListProps> = (props) => {
119126            const  transformY  = 
120127              ( expanded  ? verticalOffset  : index  *  offset )  *  ( placement . startsWith ( 'top' )  ? 1  : - 1 ) ; 
121128            const  scaleX  = 
122-               ! expanded  &&  latestNotice ?. offsetWidth  &&  dictRef . current [ key ] ?. offsetWidth 
129+               ! expanded  &&  latestNotice ?. offsetWidth  &&  dictRef . current [ strKey ] ?. offsetWidth 
123130                ? ( latestNotice ?. offsetWidth  -  offset  *  2  *  ( index  <  3  ? index  : 3 ) )  / 
124-                   dictRef . current [ key ] ?. offsetWidth 
131+                   dictRef . current [ strKey ] ?. offsetWidth 
125132                : 1 ; 
126133            stackStyle . transform  =  `translate3d(${ transformX }  , ${ transformY }  px, 0) scaleX(${ scaleX }  )` ; 
127134          }  else  { 
@@ -132,28 +139,35 @@ const NoticeList: FC<NoticeListProps> = (props) => {
132139        return  ( 
133140          < div 
134141            ref = { nodeRef } 
135-             className = { clsx ( `${ prefixCls }  -notice-wrapper` ,  motionClassName ) } 
142+             className = { clsx ( 
143+               `${ prefixCls }  -notice-wrapper` , 
144+               motionClassName , 
145+               configClassNames ?. wrapper , 
146+             ) } 
136147            style = { { 
137148              ...motionStyle , 
138149              ...stackStyle , 
139-               ...configStyle , 
150+               ...configStyles ?. wrapper , 
140151            } } 
141152            onMouseEnter = { ( )  => 
142-               setHoverKeys ( ( prev )  =>  ( prev . includes ( key )  ? prev  : [ ...prev ,  key ] ) ) 
153+               setHoverKeys ( ( prev )  =>  ( prev . includes ( strKey )  ? prev  : [ ...prev ,  strKey ] ) ) 
143154            } 
144-             onMouseLeave = { ( )  =>  setHoverKeys ( ( prev )  =>  prev . filter ( ( k )  =>  k  !==  key ) ) } 
155+             onMouseLeave = { ( )  =>  setHoverKeys ( ( prev )  =>  prev . filter ( ( k )  =>  k  !==  strKey ) ) } 
145156          > 
146157            < Notice 
147-               { ...config } 
158+               { ...restConfig } 
148159              ref = { ( node )  =>  { 
149160                if  ( dataIndex  >  - 1 )  { 
150-                   dictRef . current [ key ]  =  node ; 
161+                   dictRef . current [ strKey ]  =  node ; 
151162                }  else  { 
152-                   delete  dictRef . current [ key ] ; 
163+                   delete  dictRef . current [ strKey ] ; 
153164                } 
154165              } } 
155166              prefixCls = { prefixCls } 
167+               classNames = { configClassNames } 
168+               styles = { configStyles } 
156169              className = { clsx ( configClassName ,  ctxCls ?. notice ) } 
170+               style = { configStyle } 
157171              times = { times } 
158172              key = { key } 
159173              eventKey = { key } 
0 commit comments