Skip to content

Commit

Permalink
Merge pull request #4311 from WiXSL/patch-notification-auto-hide-dura…
Browse files Browse the repository at this point in the history
…tion

Notification component autoHideDuration prop not being used.
  • Loading branch information
fzaninotto authored Jan 17, 2020
2 parents dc4ba65 + c4545df commit e6b5830
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/Theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ You can override the notification component, for instance to change the notifica
// in src/MyNotification.js
import { Notification } from 'react-admin';

const MyNotification = props => <Notification {...props}autoHideDuration={5000} />;
const MyNotification = props => <Notification {...props} autoHideDuration={5000} />;

export default MyNotification;
```
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/actions/notificationActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const SHOW_NOTIFICATION = 'RA/SHOW_NOTIFICATION';
export type NotificationType = 'info' | 'warning' | 'error';

interface NotificationOptions {
// The type of the notification
// The duration in milliseconds the notification is shown
autoHideDuration?: number;
// Arguments used to translate the message
messageArgs?: any;
Expand Down
4 changes: 3 additions & 1 deletion packages/ra-core/src/sideEffect/useNotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ const useNotify = () => {
message: string,
type: NotificationType = 'info',
messageArgs: any = {},
undoable: boolean = false
undoable: boolean = false,
autoHideDuration?: number
) => {
dispatch(
showNotification(message, type, {
messageArgs,
undoable,
autoHideDuration,
})
);
},
Expand Down

0 comments on commit e6b5830

Please sign in to comment.