rn-custom-alert-prompt
Version:
ReactNative Alert & Prompt with no dependencies
23 lines (22 loc) • 662 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.prompt = void 0;
const subscribers_1 = require("./subscribers");
function prompt(param1, param2) {
let data;
if (typeof param1 === 'string') {
data = { title: param1, description: param2 };
}
else {
data = param1;
}
(0, subscribers_1.notifySubscribers)(data);
return new Promise(res => {
(0, subscribers_1.subscribeToModalChange)(data => {
subscribers_1.subscribers.shift();
res(data?.title);
(0, subscribers_1.notifySubscribers)(undefined);
});
});
}
exports.prompt = prompt;