UNPKG

react-native-navigation-drilldown

Version:
56 lines 3.86 kB
"use strict"; 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 Handle_1 = require("./Handle"); var icons_1 = require("./icons"); var ItemView = (function (_super) { __extends(ItemView, _super); function ItemView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.onPress = function () { var _a = _this.props, item = _a.item, onPress = _a.onPress; onPress(item); }; _this.renderContent = function () { var _a = _this.props, item = _a.item, isLeaf = _a.isLeaf, renderContent = _a.renderContent, selfSelected = _a.selfSelected, subtreeSelected = _a.subtreeSelected; return renderContent(item, isLeaf, selfSelected, subtreeSelected); }; _this.renderTitle = function () { var _a = _this.props, item = _a.item, isLeaf = _a.isLeaf, renderTitle = _a.renderTitle, selfSelected = _a.selfSelected, subtreeSelected = _a.subtreeSelected; return renderTitle(item, isLeaf, selfSelected, subtreeSelected); }; _this.renderLeftIcon = function () { var _a = _this.props, item = _a.item, isLeaf = _a.isLeaf, renderLeftIcon = _a.renderLeftIcon, selfSelected = _a.selfSelected, subtreeSelected = _a.subtreeSelected; return renderLeftIcon(item, isLeaf, selfSelected, subtreeSelected); }; _this.renderRightIcon = function () { var _a = _this.props, item = _a.item, isLeaf = _a.isLeaf, renderRightIcon = _a.renderRightIcon, selfSelected = _a.selfSelected, subtreeSelected = _a.subtreeSelected; return renderRightIcon(item, isLeaf, selfSelected, subtreeSelected); }; return _this; } ItemView.prototype.render = function () { var _a = this.props, item = _a.item, isLeaf = _a.isLeaf, selfSelected = _a.selfSelected, subtreeSelected = _a.subtreeSelected, contentStyle = _a.contentStyle, contentProps = _a.contentProps, renderContent = _a.renderContent, leftIconStyle = _a.leftIconStyle, leftIconProps = _a.leftIconProps, renderLeftIcon = _a.renderLeftIcon, titleStyle = _a.titleStyle, titleProps = _a.titleProps, renderTitle = _a.renderTitle, rightIconStyle = _a.rightIconStyle, rightIconProps = _a.rightIconProps, renderRightIcon = _a.renderRightIcon; var title = renderTitle ? undefined : item.name; var leftIcon = renderLeftIcon ? undefined : item.icon; var rightIcon = renderRightIcon ? undefined : (selfSelected ? icons_1.CHECK_ICON : (isLeaf ? undefined : (subtreeSelected ? icons_1.DONE_ALL_ICON : icons_1.ARROW_RIGHT))); return (<Handle_1.Handle onPress={this.onPress} contentStyle={contentStyle} contentProps={contentProps} renderContent={renderContent && this.renderContent} title={title} titleStyle={titleStyle} titleProps={titleProps} renderTitle={renderTitle && this.renderTitle} leftIcon={leftIcon} leftIconStyle={leftIconStyle} leftIconProps={leftIconProps} renderLeftIcon={renderLeftIcon && this.renderLeftIcon} rightIcon={rightIcon} rightIconStyle={rightIconStyle} rightIconProps={rightIconProps} renderRightIcon={renderRightIcon && this.renderRightIcon}/>); }; return ItemView; }(React.PureComponent)); exports.default = ItemView; //# sourceMappingURL=ItemView.js.map