Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getMessageInstance(callback: (i: any) => void) {
if (messageInstance) {
callback(messageInstance);
return;
}
Notification.newInstance(
{
prefixCls,
transitionName,
style: { top: defaultTop }, // 覆盖原来的样式
getContainer,
maxCount,
},
(instance: any) => {
if (messageInstance) {
callback(messageInstance);
return;
}
messageInstance = instance;
callback(instance);
},
);
function getMessageInstance() {
messageInstance = messageInstance || Notification.newInstance({
prefixCls: prefixCls,
transitionName: 'move-up',
style: { top: defaultTop },
getContainer: getContainer
});
return messageInstance;
}
function notice(content) {
function getMessageInstance() {
messageInstance = messageInstance || Notification.newInstance({
prefixCls: prefixCls,
transitionName: 'move-up',
style: { top: defaultTop },
getContainer: getContainer
});
return messageInstance;
}
function notice(content) {
import Notification from 'rc-notification';
import * as React from 'react';
const defaultDuration = 1.5;
let key = 1;
const notification = Notification.newInstance({
prefixCls : 'f-message',
transitionName: 'move-up',
style : {top:'20px' ,left:'50%'}
});
const notificationBlock = Notification.newInstance({
prefixCls : 'f-message-block',
transitionName: 'move-up',
style : {top:'150px' ,left:'50%'}
});
function notice (mes , duration = defaultDuration ,showType = 'tips' ,type ,icon){
let param = {
key,
content: <div>
<span></span></div>
function showMessage(text, duration = 1.5, type = 'success') {
Notification.newInstance({}, (notification) => {
notification.notice({
content: (
<div>
<i>
<span>{text}</span>
</i></div><i>
),
duration,
});
});
}
</i>
export default function notification(msg, type, duration) {
const content = addIcon(msg, type);
Notification.newInstance({}, (notification) => {
notification.notice({
content,
duration
});
});
}