Browse Source

fix: fix notification show and hide order (#531)

代强 3 years ago
parent
commit
5452012214

+ 4 - 8
packages/semi-foundation/notification/notificationListFoundation.ts

@@ -4,24 +4,22 @@ import { NoticeInstance, NoticePosition, NoticeProps } from '../notification/not
 import { strings } from './constants';
 import { strings } from './constants';
 
 
 
 
-
 // eslint-disable-next-line @typescript-eslint/no-empty-interface
 // eslint-disable-next-line @typescript-eslint/no-empty-interface
-export interface NotificationListProps{
+export interface NotificationListProps {
 
 
 }
 }
 
 
-export interface NotificationListState{
+export interface NotificationListState {
     notices: NoticeInstance[];
     notices: NoticeInstance[];
     removedItems: NoticeInstance[];
     removedItems: NoticeInstance[];
 }
 }
 
 
-export interface NotificationListAdapter extends DefaultAdapter<NotificationListProps, NotificationListState>{
+export interface NotificationListAdapter extends DefaultAdapter<NotificationListProps, NotificationListState> {
     updateNotices: (notices: NoticeInstance[], removedItems?: NoticeInstance[]) => void;
     updateNotices: (notices: NoticeInstance[], removedItems?: NoticeInstance[]) => void;
     getNotices: () => NoticeInstance[];
     getNotices: () => NoticeInstance[];
 }
 }
 
 
 
 
-
 export interface ConfigProps {
 export interface ConfigProps {
     top?: number | string;
     top?: number | string;
     bottom?: number | string;
     bottom?: number | string;
@@ -34,8 +32,6 @@ export interface ConfigProps {
 }
 }
 
 
 
 
-
-
 export default class NotificationListFoundation extends BaseFoundation<NotificationListAdapter> {
 export default class NotificationListFoundation extends BaseFoundation<NotificationListAdapter> {
 
 
     addNotice(opts: NoticeProps) {
     addNotice(opts: NoticeProps) {
@@ -48,7 +44,7 @@ export default class NotificationListFoundation extends BaseFoundation<Notificat
         //         this.removeNotice(opts.id);
         //         this.removeNotice(opts.id);
         //     }, opts.duration * 1000);
         //     }, opts.duration * 1000);
         // }
         // }
-        this._adapter.updateNotices([...notices, opts]);
+        this._adapter.updateNotices([opts, ...notices]);
         // return id;
         // return id;
     }
     }