react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
50 lines • 2.13 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
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 React = require("react");
var addActionSheet_native_1 = require("../../utils/addActionSheet.native");
var enums_1 = require("../../utils/enums");
var CPopoverComponent = /** @class */ (function (_super) {
__extends(CPopoverComponent, _super);
function CPopoverComponent() {
return _super !== null && _super.apply(this, arguments) || this;
}
CPopoverComponent.prototype.render = function () {
var _a = this.props, children = _a.children, connectedShowActionSheet = _a.connectedShowActionSheet;
return React.cloneElement(children, {
onPress: function () {
connectedShowActionSheet(enums_1.ACTION_SHEETS_IDS.POPOVER_ITEM_CLICK);
}
});
};
CPopoverComponent.actionSheetData = function (props) {
var _a;
var actions = props.actions, sheetActions = actions.concat([
{
title: 'Cancel',
onPress: function () {
},
}
]);
return _a = {},
_a[enums_1.ACTION_SHEETS_IDS.POPOVER_ITEM_CLICK] = {
options: sheetActions.map(function (option) { return option.title; }),
optionClick: function (index) {
sheetActions[index] && sheetActions[index].onPress();
}
},
_a;
};
return CPopoverComponent;
}(React.PureComponent));
exports.PopoverComponent = addActionSheet_native_1.connectActionSheet(CPopoverComponent);
//# sourceMappingURL=PopoverComponent.native.js.map