react-native-bottom-sheets
Version:
A tiny wrapper around @gorhom/bottom-sheet to make it easier to use in react-native projects.
50 lines (49 loc) • 2.13 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var EventEmitter_1 = require("./EventEmitter");
/**
* BottomSheetManager class for managing bottom sheet operations.
* Extends EventEmitter to provide event-based communication.
*/
var BottomSheetManager = /** @class */ (function (_super) {
__extends(BottomSheetManager, _super);
function BottomSheetManager() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Opens a bottom sheet.
* @param name - The name of the bottom sheet to open.
* @param params - Parameters to pass to the bottom sheet.
* @param callback - Optional callback to be called after opening the bottom sheet.
*/
BottomSheetManager.prototype.open = function (name, params, callback) {
this.emit("open", name, params, callback);
};
/**
* Closes a bottom sheet.
* @param name - The name of the bottom sheet to close.
* @param callback - Optional callback to be called after closing the bottom sheet.
*/
BottomSheetManager.prototype.close = function (callback) {
this.emit("close", callback);
};
return BottomSheetManager;
}(EventEmitter_1.default));
// Create a singleton instance of BottomSheetManager
var bottomSheetManager = new BottomSheetManager();
exports.default = bottomSheetManager;