New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-bottombar

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-bottombar - npm Package Compare versions

Comparing version 3.0.6 to 3.0.7

2

bottombar.android.js

@@ -7,3 +7,3 @@ "use strict";

__export(require("./src/common"));
__export(require("./src/android/bottombar-item"));
__export(require("./src/android/bottombar"));
//# sourceMappingURL=bottombar.android.js.map

@@ -7,3 +7,3 @@ "use strict";

__export(require("./src/common"));
__export(require("./src/ios/bottombar-item"));
__export(require("./src/ios/bottombar"));
//# sourceMappingURL=bottombar.ios.js.map
{
"name": "nativescript-bottombar",
"version": "3.0.6",
"version": "3.0.7",
"description": "NativeScript plugin for AHBottomNavigation.",

@@ -9,4 +9,12 @@ "main": "bottombar",

"platforms": {
"android": "3.0.0",
"ios": "3.0.0"
"android": "3.2.0",
"ios": "3.2.0"
},
"plugin": {
"nan": "true",
"pan": "true",
"core3": "true",
"vue": "true",
"webpack": "false",
"category": "Developer"
}

@@ -16,7 +24,7 @@ },

"build": "tsc",
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
"demo.android": "npm run preparedemo && cd demo && tns run android",
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-bottombar && tns plugin add .. && tns install",
"setup": "cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"typingz": "cd demo && TNS_TYPESCRIPT_DECLARATIONS_PATH='$(pwd)/typingz' tns build ios"
"demo.ios": "npm run preparedemo && cd demo-ng && tns emulate ios",
"demo.android": "npm run preparedemo && cd demo-ng && tns run android",
"preparedemo": "npm run build && cd demo-ng && tns plugin remove nativescript-bottombar && tns plugin add .. && tns install",
"setup": "cd demo-ng && npm install && cd .. && npm run build && cd demo-ng && tns plugin add .. && cd ..",
"typingz": "cd demo-ng && TNS_TYPESCRIPT_DECLARATIONS_PATH='$(pwd)/typingz' tns build ios"
},

@@ -57,6 +65,6 @@ "repository": {

"devDependencies": {
"tns-core-modules": "^3.0.1",
"tns-platform-declarations": "^3.0.1",
"tns-core-modules": "^3.2.0",
"tns-platform-declarations": "^3.2.0",
"typescript": "^2.3.2"
}
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var types_1 = require("utils/types");
var dependency_observable_1 = require("ui/core/dependency-observable");
var color_1 = require("color");
var image_source_1 = require("image-source");
var platform_1 = require("platform");
var common_1 = require("../common");
var AffectsLayout = platform_1.isAndroid ? dependency_observable_1.PropertyMetadataSettings.None : dependency_observable_1.PropertyMetadataSettings.AffectsLayout;
var bottombar_item_1 = require("./bottombar-item");
var color_1 = require("tns-core-modules/color");
var image_source_1 = require("tns-core-modules/image-source");
var BitmapDrawable = android.graphics.drawable.BitmapDrawable;

@@ -14,100 +11,2 @@ var AHBottomNavigation = com.aurelhubert.ahbottomnavigation.AHBottomNavigation;

var AHNotification = com.aurelhubert.ahbottomnavigation.notification.AHNotification;
var BottomBarItem = (function () {
function BottomBarItem(index, title, icon, color, notification, parent) {
this._index = index;
this._title = title;
this._icon = icon;
this._color = color;
if (notification) {
this._notification = notification;
}
if (parent) {
this._parent = parent;
}
}
Object.defineProperty(BottomBarItem.prototype, "index", {
get: function () {
return this._index;
},
set: function (indexValue) {
this._index = indexValue;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "title", {
get: function () {
return this._title;
},
set: function (value) {
if (this._title !== value && value && this._parent) {
this._title = value;
this._parent.get().changeItemTitle(this._index, this._title);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "icon", {
get: function () {
return this._icon;
},
set: function (value) {
if (this._icon !== value && value && this._parent) {
this._icon = value;
this._parent.get().changeItemIcon(this._index, this._icon);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "color", {
get: function () {
return this._color;
},
set: function (value) {
if (this._color !== value && value && this._parent) {
this._color = value;
this._parent.get().changeItemColor(this._index, this._color);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "notification", {
get: function () {
return this._notification;
},
set: function (value) {
if (this._notification !== value && value && this._parent) {
this._notification = value;
if (this._notification.value !== "") {
var newNotification = new AHNotification.Builder()
.setText(this._notification.value)
.setBackgroundColor(new color_1.Color(this._notification.backgroundColor).android)
.setTextColor(new color_1.Color(this._notification.textColor).android)
.build();
this._parent.get().android.setNotification(newNotification, this._index);
}
else {
this._parent.get().android.setNotification("", this._index);
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "parent", {
get: function () {
return this._parent;
},
set: function (parent) {
this._parent = parent;
},
enumerable: true,
configurable: true
});
return BottomBarItem;
}());
exports.BottomBarItem = BottomBarItem;
var BottomBar = (function (_super) {

@@ -120,3 +19,3 @@ __extends(BottomBar, _super);

get: function () {
return this._android;
return this.nativeView;
},

@@ -126,68 +25,65 @@ enumerable: true,

});
Object.defineProperty(BottomBar.prototype, "_nativeView", {
get: function () {
return this._android;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBar.prototype, "currentIndex", {
get: function () {
return this._android.getCurrentItem();
},
enumerable: true,
configurable: true
});
BottomBar.prototype._createUI = function () {
this._android = new AHBottomNavigation(this._context);
BottomBar.prototype.createNativeView = function () {
var nativeView = new AHBottomNavigation(this._context);
var that = new WeakRef(this);
this._listener = new AHBottomNavigation.OnTabSelectedListener({
this.selectedIndex = 0;
nativeView.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener({
get owner() {
return that.get();
},
onTabSelected: function (position, wasSelected) {
var bar = that.get();
var oldIndex = bar.selectedIndex;
if (bar && bar.selectedIndex !== position) {
bar.selectedIndex = position;
if (this.owner && !wasSelected && this.owner.selectedIndex !== position) {
var eventData = {
eventName: "tabSelected",
object: this,
oldIndex: this.owner.selectedIndex,
newIndex: position
};
this.owner.selectedIndex = position;
this.owner.notify(eventData);
}
return true;
}
});
this._android.setOnTabSelectedListener(null);
this._android.setOnTabSelectedListener(this._listener);
var owner = that.get();
if (types_1.isDefined(owner.titleState)) {
this.setTitleStateNative(owner.titleState);
}));
nativeView.setDefaultBackgroundColor(new color_1.Color('#333').android);
nativeView.setColored(true);
return nativeView;
};
BottomBar.prototype[common_1.itemsProperty.setNative] = function (value) {
var items = value;
this.createItems(items);
};
BottomBar.prototype[common_1.titleStateProperty.setNative] = function (titleState) {
switch (titleState) {
case 1:
this.nativeView.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
break;
case 0:
this.nativeView.setTitleState(AHBottomNavigation.TitleState.SHOW_WHEN_ACTIVE);
break;
case 2:
this.nativeView.setTitleState(AHBottomNavigation.TitleState.ALWAYS_HIDE);
break;
}
};
BottomBar.prototype[common_1.hideProperty.setNative] = function (hide) {
if (hide) {
this.nativeView.hideBottomNavigation();
}
else {
this._android.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
this.nativeView.restoreBottomNavigation();
}
this._android.setDefaultBackgroundColor(new color_1.Color('#FFFCFF').android);
this._android.setColored(true);
};
BottomBar.prototype._onItemsPropertyChangedSetNativeValue = function (data) {
var items = data.newValue;
this.createItems(items);
BottomBar.prototype[common_1.accentColorProperty.setNative] = function (accentColor) {
this.nativeView.setAccentColor(new color_1.Color(accentColor).android);
};
BottomBar.prototype.createItems = function (items) {
var _this = this;
this._android.removeAllItems();
items.forEach(function (item, idx, arr) {
var notif = item.notification;
if (!notif) {
notif = new common_1.Notification("white", "red", "");
}
_this.items[idx] = new BottomBarItem(item.index, item.title, item.icon, item.color, notif, new WeakRef(_this));
var icon1 = new BitmapDrawable(image_source_1.fromResource(item.icon).android);
var item1 = new AHBottomNavigationItem(item.title, icon1, new color_1.Color(item.color).android);
_this._android.addItem(item1);
var newNotification = new AHNotification.Builder()
.setText(notif.value)
.setBackgroundColor(new color_1.Color(notif.backgroundColor).android)
.setTextColor(new color_1.Color(notif.textColor).android)
.build();
_this._android.setNotification(newNotification, idx);
});
if (this.selectedIndex != null) {
this._android.setCurrentItem(this.selectedIndex);
}
BottomBar.prototype[common_1.inactiveColorProperty.setNative] = function (inactiveColor) {
this.nativeView.setInactiveColor(new color_1.Color(inactiveColor).android);
};
BottomBar.prototype[common_1.coloredProperty.setNative] = function (colored) {
this.nativeView.setColored(colored);
};
BottomBar.prototype[common_1.uncoloredBackgroundColorProperty.setNative] = function (uncoloredBackgroundColor) {
this.nativeView.setDefaultBackgroundColor(new color_1.Color(uncoloredBackgroundColor).android);
};
BottomBar.prototype.changeItemTitle = function (index, title) {

@@ -200,5 +96,5 @@ var item = this.items[index];

};
BottomBar.prototype.changeItemColor = function (index, color) {
BottomBar.prototype.changeItemIcon = function (index, icon) {
var item = this.items[index];
if (item.color !== color) {
if (item.icon !== icon) {
this.items[index] = item;

@@ -208,5 +104,5 @@ }

};
BottomBar.prototype.changeItemIcon = function (index, icon) {
BottomBar.prototype.changeItemColor = function (index, color) {
var item = this.items[index];
if (item.icon !== icon) {
if (item.color !== color) {
this.items[index] = item;

@@ -216,54 +112,31 @@ }

};
BottomBar.prototype._titleStatePropertyChangedSetNativeValue = function (data) {
_super.prototype._titleStatePropertyChangedSetNativeValue.call(this, data);
var newTitleState = data.newValue;
this.setTitleStateNative(newTitleState);
BottomBar.prototype.selectItemNative = function (index) {
this.nativeView.setCurrentItem(this.selectedIndex);
};
BottomBar.prototype.setTitleStateNative = function (newTitleState) {
switch (newTitleState) {
case 1:
this._android.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
break;
case 0:
this._android.setTitleState(AHBottomNavigation.TitleState.SHOW_WHEN_ACTIVE);
break;
case 2:
this._android.setTitleState(AHBottomNavigation.TitleState.ALWAYS_HIDE);
break;
}
BottomBar.prototype.createItems = function (items) {
var _this = this;
this.nativeView.removeAllItems();
items.forEach(function (item, idx, aar) {
var notif = item.notification;
if (!notif) {
notif = new common_1.Notification("white", "red", "");
}
_this.items[idx] = new bottombar_item_1.BottomBarItem(item.index, item.title, item.icon, item.color, notif, new WeakRef(_this));
var icon1 = new BitmapDrawable(image_source_1.fromResource(item.icon).android);
var item1 = new AHBottomNavigationItem(item.title, icon1, new color_1.Color(item.color).android);
_this.nativeView.addItem(item1);
var newNotification = new AHNotification.Builder()
.setText(notif.value)
.setBackgroundColor(new color_1.Color(notif.backgroundColor).android)
.setTextColor(new color_1.Color(notif.textColor).android)
.build();
_this.nativeView.setNotification(newNotification, idx);
});
this.nativeView.setCurrentItem(this.selectedIndex);
};
BottomBar.prototype._hidePropertyChangedSetNativeValue = function (data) {
_super.prototype._hidePropertyChangedSetNativeValue.call(this, data);
var newHideValue = data.newValue;
if (newHideValue) {
this._android.hideBottomNavigation();
}
else {
this._android.restoreBottomNavigation();
}
};
BottomBar.prototype.setNotification = function (value, index) {
this._android.setNotification(value, index);
this.nativeView.setNotification(value, index);
};
BottomBar.prototype._accentColorPropertyChangedSetNativeValue = function (data) {
_super.prototype._accentColorPropertyChangedSetNativeValue.call(this, data);
var newAccentColorValue = data.newValue;
this._android.setAccentColor(new color_1.Color(newAccentColorValue).android);
};
BottomBar.prototype._inactiveColorPropertyChangedSetNativeValue = function (data) {
_super.prototype._inactiveColorPropertyChangedSetNativeValue.call(this, data);
var newInactiveColorValue = data.newValue;
this._android.setInactiveColor(new color_1.Color(newInactiveColorValue).android);
};
BottomBar.prototype._coloredPropertyChangedSetNativeValue = function (data) {
_super.prototype._coloredPropertyChangedSetNativeValue.call(this, data);
var newColoredValue = data.newValue;
this._android.setColored(newColoredValue);
};
BottomBar.prototype.selectItemNative = function (index) {
this._android.setCurrentItem(this.selectedIndex);
};
return BottomBar;
}(common_1.BottomBarCommon));
}(common_1.BottomBarBase));
exports.BottomBar = BottomBar;
//# sourceMappingURL=bottombar.js.map
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var dependency_observable_1 = require("ui/core/dependency-observable");
var proxy_1 = require("ui/core/proxy");
var view_1 = require("ui/core/view");
var types_1 = require("utils/types");
var Notification = (function () {
function Notification(textColorValue, backgroundColorValue, valueValue) {
this._textColor = textColorValue;
this._backgroundColor = backgroundColorValue;
this._value = valueValue;
}
Object.defineProperty(Notification.prototype, "textColor", {
get: function () {
return this._textColor;
},
set: function (textColorValue) {
this._textColor = textColorValue;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Notification.prototype, "backgroundColor", {
get: function () {
return this._backgroundColor;
},
set: function (backgroundColorValue) {
this._backgroundColor = backgroundColorValue;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Notification.prototype, "value", {
get: function () {
return this._value;
},
set: function (valueValue) {
this._value = valueValue;
},
enumerable: true,
configurable: true
});
return Notification;
}());
exports.Notification = Notification;
var ITEMS = "items", SELECTED_INDEX = "selectedIndex", BOTTOM_NAV = "BottomBarCommon", CHILD_BOTTOM_NAV_ITEM = "BottomBarItemCommon", TITLE_STATE_PROPERTY = "titleState", HIDE = "hide", INACTIVE_COLOR = "inactiveColor", ACCENT_COLOR = "accentColor", COLORED = "colored";
var itemsProperty = new dependency_observable_1.Property(ITEMS, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), selectedIndexProperty = new dependency_observable_1.Property(SELECTED_INDEX, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), titleStateProperty = new dependency_observable_1.Property(TITLE_STATE_PROPERTY, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), hideProperty = new dependency_observable_1.Property(HIDE, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), inactiveColorProperty = new dependency_observable_1.Property(INACTIVE_COLOR, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), accentColorProperty = new dependency_observable_1.Property(ACCENT_COLOR, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined)), coloredProperty = new dependency_observable_1.Property(COLORED, BOTTOM_NAV, new proxy_1.PropertyMetadata(undefined));
itemsProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._onItemsPropertyChangedSetNativeValue(data);
};
selectedIndexProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._onSelectedIndexPropertyChangedSetNativeValue(data);
};
titleStateProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._titleStatePropertyChangedSetNativeValue(data);
};
hideProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._hidePropertyChangedSetNativeValue(data);
};
accentColorProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._accentColorPropertyChangedSetNativeValue(data);
};
inactiveColorProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._inactiveColorPropertyChangedSetNativeValue(data);
};
coloredProperty.metadata.onSetNativeValue = function (data) {
var bottomnav = data.object;
bottomnav._coloredPropertyChangedSetNativeValue(data);
};
var BottomBarCommon = (function (_super) {
__extends(BottomBarCommon, _super);
function BottomBarCommon() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(BottomBarCommon.prototype, "items", {
get: function () {
return this._getValue(BottomBarCommon.itemsProperty);
},
set: function (value) {
this._setValue(BottomBarCommon.itemsProperty, value);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._onItemsPropertyChangedSetNativeValue = function (data) {
};
Object.defineProperty(BottomBarCommon.prototype, "selectedIndex", {
get: function () {
return this._getValue(BottomBarCommon.selectedIndexProperty);
},
set: function (value) {
this._setValue(BottomBarCommon.selectedIndexProperty, value);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._onSelectedIndexPropertyChangedSetNativeValue = function (data) {
var index = this.selectedIndex;
if (types_1.isUndefined(index)) {
return;
}
if (types_1.isDefined(this.items)) {
if (index < 0 || index >= this.items.length) {
this.selectedIndex = undefined;
throw new Error("SelectedIndex should be between [0, items.length)");
}
}
var args = {
eventName: BottomBarCommon.tabSelectedEvent,
object: this,
oldIndex: data.oldValue,
newIndex: data.newValue
};
this.notify(args);
};
Object.defineProperty(BottomBarCommon.prototype, "titleState", {
get: function () {
return this._getValue(BottomBarCommon.titleStateProperty);
},
set: function (titleStateValue) {
this._setValue(BottomBarCommon.titleStateProperty, titleStateValue);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._titleStatePropertyChangedSetNativeValue = function (data) {
var newTitleState = data.newValue;
if (types_1.isDefined(newTitleState)) {
if (!types_1.isNumber(newTitleState)) {
throw new Error("Must be an enum");
}
}
else {
throw new Error('Must have titleState');
}
};
Object.defineProperty(BottomBarCommon.prototype, "hide", {
get: function () {
return this._getValue(BottomBarCommon.hideProperty);
},
set: function (hideValue) {
this._setValue(BottomBarCommon.hideProperty, hideValue);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._hidePropertyChangedSetNativeValue = function (data) {
var newHideValue = data.newValue;
if (types_1.isDefined(newHideValue)) {
if (!types_1.isBoolean(newHideValue)) {
throw new Error("Must be a boolean");
}
}
else {
throw new Error('Must have hide');
}
};
BottomBarCommon.prototype.setNotification = function (value, index) { };
Object.defineProperty(BottomBarCommon.prototype, "accentColor", {
get: function () {
return this._getValue(BottomBarCommon.accentColorProperty);
},
set: function (accentColorValue) {
this._setValue(BottomBarCommon.accentColorProperty, accentColorValue);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._accentColorPropertyChangedSetNativeValue = function (data) {
var newAccentColorValue = data.newValue;
if (types_1.isDefined(newAccentColorValue)) {
if (!types_1.isString(newAccentColorValue)) {
throw new Error("Must be a string");
}
}
else {
throw new Error('Must have accent color');
}
};
Object.defineProperty(BottomBarCommon.prototype, "inactiveColor", {
get: function () {
return this._getValue(BottomBarCommon.inactiveColorProperty);
},
set: function (inactiveColorValue) {
this._setValue(BottomBarCommon.inactiveColorProperty, inactiveColorValue);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._inactiveColorPropertyChangedSetNativeValue = function (data) {
var newInactiveColorValue = data.newValue;
if (types_1.isDefined(newInactiveColorValue)) {
if (!types_1.isString(newInactiveColorValue)) {
throw new Error("Must be a string");
}
}
else {
throw new Error('Must have accent color');
}
};
Object.defineProperty(BottomBarCommon.prototype, "colored", {
get: function () {
return this._getValue(BottomBarCommon.coloredProperty);
},
set: function (coloredValued) {
this._setValue(BottomBarCommon.coloredProperty, coloredValued);
},
enumerable: true,
configurable: true
});
BottomBarCommon.prototype._coloredPropertyChangedSetNativeValue = function (data) {
var newHideValue = data.newValue;
if (types_1.isDefined(newHideValue)) {
if (!types_1.isBoolean(newHideValue)) {
throw new Error("Must be a boolean");
}
}
else {
throw new Error('Must have colored');
}
};
BottomBarCommon.prototype.selectItem = function (index) {
if (index !== this.selectedIndex) {
this.selectedIndex = index;
this.selectItemNative(index);
}
};
BottomBarCommon.prototype.selectItemNative = function (index) { };
return BottomBarCommon;
}(view_1.View));
BottomBarCommon.itemsProperty = itemsProperty;
BottomBarCommon.selectedIndexProperty = selectedIndexProperty;
BottomBarCommon.tabSelectedEvent = "tabSelected";
BottomBarCommon.titleStateProperty = titleStateProperty;
BottomBarCommon.hideProperty = hideProperty;
BottomBarCommon.accentColorProperty = accentColorProperty;
BottomBarCommon.inactiveColorProperty = inactiveColorProperty;
BottomBarCommon.coloredProperty = coloredProperty;
exports.BottomBarCommon = BottomBarCommon;
//# sourceMappingURL=common.js.map
__export(require("./notification"));
__export(require("./bottombar-item"));
__export(require("./bottombar"));
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var image_1 = require("ui/image");
var color_1 = require("color");
var common_1 = require("../common");
var imageSource = require("image-source");
var BottomBarItem = (function () {
function BottomBarItem(index, title, icon, color, notification, parent) {
this._index = index;
this._title = title;
this._icon = icon;
this._color = color;
if (notification) {
this._notification = notification;
}
if (parent) {
this._parent = parent;
}
}
Object.defineProperty(BottomBarItem.prototype, "index", {
get: function () {
return this._index;
},
set: function (indexValue) {
this._index = indexValue;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "title", {
get: function () {
return this._title;
},
set: function (value) {
if (this._title !== value && value && this._parent) {
this._title = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "icon", {
get: function () {
return this._icon;
},
set: function (value) {
if (this._icon !== value && value && this._parent) {
this._icon = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "color", {
get: function () {
console.log('get color');
return this._color;
},
set: function (value) {
console.log('set color');
console.log(value);
if (this._color !== value && value) {
this._color = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "notification", {
get: function () {
return this._notification;
},
set: function (value) {
if (this._notification !== value && value && this._parent) {
this._notification = value;
this._parent.get().ios.changeBadgeItem(this._index, this._notification.value);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBarItem.prototype, "parent", {
get: function () {
return this._parent;
},
set: function (parentValue) {
this._parent = parentValue;
},
enumerable: true,
configurable: true
});
return BottomBarItem;
}());
exports.BottomBarItem = BottomBarItem;
var color_1 = require("tns-core-modules/color");
var image_source_1 = require("tns-core-modules/image-source");
var BottomBarDelegate = (function (_super) {

@@ -107,5 +18,3 @@ __extends(BottomBarDelegate, _super);

var bar = this._owner.get();
if (index !== bar.selectedIndex) {
bar.selectedIndex = index;
}
bar.tabSelected(index);
};

@@ -121,18 +30,36 @@ return BottomBarDelegate;

var items = new Array();
_this._ios = new MiniTabBar({
_this.nativeView = new MiniTabBar({
items: items,
titleState: 0
});
_this.selectedIndex = 0;
_this._delegate = BottomBarDelegate.initWithOwner(new WeakRef(_this));
_this._ios.frame = CGRectMake(0, 400, 400, 44);
_this._ios.tintColor = new color_1.Color("red").ios;
_this._ios.font = UIFont.systemFontOfSize(10);
_this._ios.backgroundColor = new color_1.Color('black').ios;
_this._ios.backgroundBlurEnabled = true;
_this._ios.keyLine.isHidden = false;
_this.nativeView.frame = CGRectMake(0, 400, 400, 44);
_this.nativeView.tintColor = new color_1.Color("red").ios;
_this.nativeView.font = UIFont.systemFontOfSize(10);
_this.nativeView.backgroundColor = new color_1.Color('black').ios;
_this.nativeView.backgroundBlurEnabled = false;
_this.nativeView.keyLine.isHidden = true;
return _this;
}
BottomBar.prototype._onItemsPropertyChangedSetNativeValue = function (data) {
_super.prototype._onItemsPropertyChangedSetNativeValue.call(this, data);
var items = data.newValue;
Object.defineProperty(BottomBar.prototype, "ios", {
get: function () {
return this.nativeView;
},
enumerable: true,
configurable: true
});
BottomBar.prototype.onLoaded = function () {
_super.prototype.onLoaded.call(this);
this.nativeView.delegate = this._delegate;
};
BottomBar.prototype.onUnloaded = function () {
this.nativeView.delegate = null;
_super.prototype.onUnloaded.call(this);
};
BottomBar.prototype.disposeNativeView = function () {
this._delegate = null;
};
BottomBar.prototype[common_1.itemsProperty.setNative] = function (value) {
var items = value;
this.createItems(items);

@@ -149,4 +76,3 @@ };

item.parent = new WeakRef(_this);
var image = new image_1.Image();
var imageSourceValue = imageSource.fromResource(item.icon);
var imageSourceValue = image_source_1.fromResource(item.icon);
var item1 = new MiniTabBarItem({

@@ -160,64 +86,52 @@ title: item.title,

});
this._ios.setItems(itemsMiniTabBar);
this.nativeView.setItems(itemsMiniTabBar);
};
BottomBar.prototype._hidePropertyChangedSetNativeValue = function (data) {
var newHideValue = data.newValue;
_super.prototype._hidePropertyChangedSetNativeValue.call(this, data);
if (newHideValue) {
this._ios.hide();
BottomBar.prototype[common_1.hideProperty.setNative] = function (hide) {
if (hide) {
this.nativeView.hide();
}
else {
this._ios.show();
this.nativeView.show();
}
};
BottomBar.prototype._titleStatePropertyChangedSetNativeValue = function (data) {
_super.prototype._titleStatePropertyChangedSetNativeValue.call(this, data);
var newTitleState = data.newValue;
this._ios.titleState = newTitleState;
BottomBar.prototype[common_1.titleStateProperty.setNative] = function (titleState) {
this.nativeView.titleState = titleState;
};
BottomBar.prototype._accentColorPropertyChangedSetNativeValue = function (data) {
_super.prototype._accentColorPropertyChangedSetNativeValue.call(this, data);
var newAccentColorValue = data.newValue;
this._ios.tintColor = new color_1.Color(newAccentColorValue).ios;
BottomBar.prototype[common_1.accentColorProperty.setNative] = function (accentColor) {
this.nativeView.tintColor = new color_1.Color(accentColor).ios;
};
BottomBar.prototype._inactiveColorPropertyChangedSetNativeValue = function (data) {
_super.prototype._inactiveColorPropertyChangedSetNativeValue.call(this, data);
var newInactiveColorValue = data.newValue;
this._ios.inactiveColor = new color_1.Color(newInactiveColorValue).ios;
BottomBar.prototype[common_1.inactiveColorProperty.setNative] = function (inactiveColor) {
this.nativeView.inactiveColor = new color_1.Color(inactiveColor).ios;
};
BottomBar.prototype._coloredPropertyChangedSetNativeValue = function (data) {
_super.prototype._coloredPropertyChangedSetNativeValue.call(this, data);
var newColoredValue = data.newValue;
this._ios.colored = newColoredValue;
BottomBar.prototype[common_1.uncoloredBackgroundColorProperty.setNative] = function (uncoloredBackgroundColor) {
this.nativeView.uncoloredBackgroundColor = new color_1.Color(uncoloredBackgroundColor).ios;
};
BottomBar.prototype[common_1.coloredProperty.setNative] = function (colored) {
this.nativeView.colored = colored;
};
BottomBar.prototype.setNotification = function (value, index) {
this._ios.changeBadgeItem(index, value);
this.nativeView.changeBadgeItem(index, value);
};
BottomBar.prototype.setBadge = function (badgeIndex, badgeValue) {
this._ios.changeBadgeItem(badgeIndex, badgeValue);
this.nativeView.changeBadgeItem(badgeIndex, badgeValue);
};
BottomBar.prototype.tabSelected = function (index) {
if (index !== this.selectedIndex) {
var eventData = {
eventName: "tabSelected",
object: this,
oldIndex: this.selectedIndex,
newIndex: index
};
this.selectedIndex = index;
this.notify(eventData);
}
};
BottomBar.prototype.selectItemNative = function (index) {
this._ios.selectItemAnimated(index, true);
this.nativeView.selectItemAnimated(index, true);
};
Object.defineProperty(BottomBar.prototype, "ios", {
get: function () {
return this._ios;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BottomBar.prototype, "_nativeView", {
get: function () {
return this._ios;
},
enumerable: true,
configurable: true
});
BottomBar.prototype.onLoaded = function () {
_super.prototype.onLoaded.call(this);
this._ios.delegate = this._delegate;
BottomBar.prototype.createCustomView = function () {
};
return BottomBar;
}(common_1.BottomBarCommon));
}(common_1.BottomBarBase));
exports.BottomBar = BottomBar;
//# sourceMappingURL=bottombar.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc