nativescript-bottom-navigation
Version:
NativeScript plugin to add a bottom navigation component for Android & iOS
133 lines • 4.9 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var view_1 = require("tns-core-modules/ui/core/view");
var internals_1 = require("../internal/internals");
var BottomNavigationBarBase = (function (_super) {
__extends(BottomNavigationBarBase, _super);
function BottomNavigationBarBase() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.selectedTabIndex = 0;
_this.titleVisibility = internals_1.TitleVisibility.Selected;
_this._items = [];
return _this;
}
BottomNavigationBarBase_1 = BottomNavigationBarBase;
Object.defineProperty(BottomNavigationBarBase.prototype, "items", {
get: function () {
return this._items;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomNavigationBarBase.prototype, "inactiveColor", {
get: function () {
return this.style.inactiveColor;
},
set: function (color) {
this.style.inactiveColor = color;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomNavigationBarBase.prototype, "activeColor", {
get: function () {
return this.style.activeColor;
},
set: function (color) {
this.style.activeColor = color;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomNavigationBarBase.prototype, "backgroundColor", {
get: function () {
return this.style.backgroundColor;
},
set: function (color) {
this.style.backgroundColor = color;
},
enumerable: true,
configurable: true
});
BottomNavigationBarBase.prototype.selectTab = function (index) {
if (index === this.selectedTabIndex) {
return;
}
this.selectTabNative(index);
};
BottomNavigationBarBase.prototype._emitTabPressed = function (index) {
var eventData = {
eventName: BottomNavigationBarBase_1.tabPressedEvent,
object: this,
index: index,
};
this.notify(eventData);
this.removeBadge(index);
};
BottomNavigationBarBase.prototype._emitTabSelected = function (index) {
var eventData = {
eventName: BottomNavigationBarBase_1.tabSelectedEvent,
object: this,
oldIndex: this.selectedTabIndex,
newIndex: index,
};
this.selectedTabIndex = index;
this.notify(eventData);
this.removeBadge(index);
};
BottomNavigationBarBase.prototype._emitTabReselected = function (index) {
var eventData = {
eventName: BottomNavigationBarBase_1.tabReselectedEvent,
object: this,
index: index,
};
this.notify(eventData);
};
BottomNavigationBarBase.prototype._addChildFromBuilder = function (name, value) {
if (name === 'BottomNavigationTab') {
if (!this._items) {
this._items = [];
}
this._items.push(value);
}
};
var BottomNavigationBarBase_1;
BottomNavigationBarBase.tabPressedEvent = 'tabPressed';
BottomNavigationBarBase.tabSelectedEvent = 'tabSelected';
BottomNavigationBarBase.tabReselectedEvent = 'tabReselected';
BottomNavigationBarBase = BottomNavigationBarBase_1 = __decorate([
view_1.CSSType('BottomNavigationBar')
], BottomNavigationBarBase);
return BottomNavigationBarBase;
}(view_1.View));
exports.BottomNavigationBarBase = BottomNavigationBarBase;
exports.tabsProperty = new view_1.Property({
name: 'tabs',
affectsLayout: true,
});
exports.tabsProperty.register(BottomNavigationBarBase);
exports.titleVisibilityProperty = new view_1.Property({
name: 'titleVisibility',
equalityComparer: function (x, y) { return x === y; },
affectsLayout: true,
defaultValue: internals_1.TitleVisibility.Selected,
valueConverter: function (v) { return internals_1.TitleVisibility[v]; },
});
exports.titleVisibilityProperty.register(BottomNavigationBarBase);
exports.activeColorCssProperty = new view_1.CssProperty({
name: 'activeColor',
cssName: 'active-color',
equalityComparer: view_1.Color.equals,
defaultValue: new view_1.Color('black'),
valueConverter: function (v) { return new view_1.Color(v); },
});
exports.activeColorCssProperty.register(view_1.Style);
exports.inactiveColorCssProperty = new view_1.CssProperty({
name: 'inactiveColor',
cssName: 'inactive-color',
equalityComparer: view_1.Color.equals,
defaultValue: new view_1.Color('gray'),
valueConverter: function (v) { return new view_1.Color(v); },
});
exports.inactiveColorCssProperty.register(view_1.Style);
//# sourceMappingURL=bottom-navigation-bar.base.js.map
;