Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const button = MDCSnackbarMessageAction.alloc().init();
button.title = options.actionText;
message.text = options.message;
message.duration = options.hideDelay;
message.action = button;
message.completionHandler = (userInitiated: boolean) => {
this._shown = false;
resolve({
action: SnackBarAction.DISMISS,
reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
});
};
if (options.textColor && Color.isValid(options.textColor)) {
this._setTextColor(options.textColor);
}
if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
message.buttonTextColor = new Color(options.actionTextColor).ios;
}
if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
this._setBackgroundColor(options.backgroundColor);
}
this._snackbarManager.showMessage(message);
}
this._snackbarManager.messageTextColor = null;
this._snackbarManager.snackbarMessageViewBackgroundColor = null;
const snackBarMessage = (this._message = MDCSnackbarMessage.new());
snackBarMessage.text = message;
snackBarMessage.duration = timeout;
snackBarMessage.completionHandler = () => {
resolve({
action: 'Dismiss',
reason: DismissReasons.TIMEOUT
});
};
if (textColor && Color.isValid(textColor)) {
this._setTextColor(textColor);
}
if (backgroundColor && Color.isValid(backgroundColor)) {
this._setBackgroundColor(backgroundColor);
}
} catch (ex) {
reject(ex);
}
});
}
this._shown = false;
resolve({
action: SnackBarAction.DISMISS,
reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
});
};
if (options.textColor && Color.isValid(options.textColor)) {
this._setTextColor(options.textColor);
}
if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
message.buttonTextColor = new Color(options.actionTextColor).ios;
}
if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
this._setBackgroundColor(options.backgroundColor);
}
this._snackbarManager.showMessage(message);
}
message.text = options.message;
message.duration = options.hideDelay;
message.action = button;
message.completionHandler = (userInitiated: boolean) => {
this._shown = false;
resolve({
action: SnackBarAction.DISMISS,
reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
});
};
if (options.textColor && Color.isValid(options.textColor)) {
this._setTextColor(options.textColor);
}
if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
message.buttonTextColor = new Color(options.actionTextColor).ios;
}
if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
this._setBackgroundColor(options.backgroundColor);
}
this._snackbarManager.showMessage(message);
}
opts.colors.forEach(c => {
if (Color.isValid(c)) {
let parsedColor = new Color(c).android;
androidColorArray.push(parsedColor);
}
})
mSmallBang.setColors(androidColorArray);
const snackBarMessage = (this._message = MDCSnackbarMessage.new());
snackBarMessage.text = message;
snackBarMessage.duration = timeout;
snackBarMessage.completionHandler = () => {
resolve({
action: 'Dismiss',
reason: DismissReasons.TIMEOUT
});
};
if (textColor && Color.isValid(textColor)) {
this._setTextColor(textColor);
}
if (backgroundColor && Color.isValid(backgroundColor)) {
this._setBackgroundColor(backgroundColor);
}
} catch (ex) {
reject(ex);
}
});
}