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

nativescript-bottom-navigation

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-bottom-navigation - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

angular/index.metadata.json

7

angular/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./nativescript-bottom-navigation.module"));
//# sourceMappingURL=index.js.map
var nativescript_bottom_navigation_module_1 = require("./nativescript-bottom-navigation.module");
exports.NativescriptBottomNavigationModule = nativescript_bottom_navigation_module_1.NativescriptBottomNavigationModule;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var _1 = require("../");
var lang_facade_1 = require("nativescript-angular/lang-facade");

@@ -108,41 +109,18 @@ var BottomNavigationDirective = (function () {

};
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationDirective.prototype, "activeColor", null);
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationDirective.prototype, "inactiveColor", null);
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationDirective.prototype, "backgroundColor", null);
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationDirective.prototype, "keyLineColor", null);
__decorate([
core_1.Input(),
__metadata("design:type", Array),
__metadata("design:paramtypes", [Array])
], BottomNavigationDirective.prototype, "tabs", null);
__decorate([
core_1.Input(),
__metadata("design:type", Number),
__metadata("design:paramtypes", [Number])
], BottomNavigationDirective.prototype, "selectedTabIndex", null);
BottomNavigationDirective = __decorate([
core_1.Directive({
selector: "BottomNavigation"
}),
__metadata("design:paramtypes", [core_1.ElementRef])
], BottomNavigationDirective);
return BottomNavigationDirective;
}());
exports.BottomNavigationDirective = BottomNavigationDirective;
function BottomNavigationDirective_tsickle_Closure_declarations() {
BottomNavigationDirective.decorators;
BottomNavigationDirective.ctorParameters;
BottomNavigationDirective.propDecorators;
BottomNavigationDirective.prototype.bottomNavigation;
BottomNavigationDirective.prototype._viewInitialized;
BottomNavigationDirective.prototype._activeColor;
BottomNavigationDirective.prototype._inactiveColor;
BottomNavigationDirective.prototype._backgroundColor;
BottomNavigationDirective.prototype._keyLineColor;
BottomNavigationDirective.prototype._tabs;
BottomNavigationDirective.prototype._selectedTabIndex;
}
var BottomNavigationTabDirective = (function () {

@@ -181,25 +159,13 @@ function BottomNavigationTabDirective() {

});
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationTabDirective.prototype, "title", null);
__decorate([
core_1.Input(),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], BottomNavigationTabDirective.prototype, "icon", null);
__decorate([
core_1.Input(),
__metadata("design:type", Boolean)
], BottomNavigationTabDirective.prototype, "_selectable", void 0);
BottomNavigationTabDirective = __decorate([
core_1.Directive({
selector: "BottomNavigationTab"
})
], BottomNavigationTabDirective);
return BottomNavigationTabDirective;
}());
exports.BottomNavigationTabDirective = BottomNavigationTabDirective;
function BottomNavigationTabDirective_tsickle_Closure_declarations() {
BottomNavigationTabDirective.decorators;
BottomNavigationTabDirective.ctorParameters;
BottomNavigationTabDirective.propDecorators;
BottomNavigationTabDirective.prototype._title;
BottomNavigationTabDirective.prototype._icon;
BottomNavigationTabDirective.prototype._selectable;
}
exports.DIRECTIVES = [BottomNavigationDirective, BottomNavigationTabDirective];
//# sourceMappingURL=nativescript-bottom-navigation.directives.js.map

@@ -9,13 +9,10 @@ "use strict";

}
NativescriptBottomNavigationModule = __decorate([
core_1.NgModule({
declarations: [nativescript_bottom_navigation_directives_1.DIRECTIVES],
exports: [nativescript_bottom_navigation_directives_1.DIRECTIVES],
})
], NativescriptBottomNavigationModule);
return NativescriptBottomNavigationModule;
}());
exports.NativescriptBottomNavigationModule = NativescriptBottomNavigationModule;
function NativescriptBottomNavigationModule_tsickle_Closure_declarations() {
NativescriptBottomNavigationModule.decorators;
NativescriptBottomNavigationModule.ctorParameters;
}
element_registry_1.registerElement("BottomNavigation", function () { return require("../").BottomNavigation; });
element_registry_1.registerElement("BottomNavigationTab", function () { return require("../").BottomNavigationTab; });
//# sourceMappingURL=nativescript-bottom-navigation.module.js.map

@@ -29,6 +29,10 @@ "use strict";

onTabSelected: function (position, wasSelected) {
if (this.owner && !wasSelected && this.owner.selectedTabIndex !== position) {
return this.owner.onTabSelected(position);
var bottomNavigationTab = this.owner.tabs[position];
if (!wasSelected && bottomNavigationTab.selectable) {
this.owner.onTabSelected(position);
}
return true;
if (!wasSelected && !bottomNavigationTab.selectable) {
this.owner.onTabPressed(position);
}
return bottomNavigationTab.selectable;
}

@@ -99,2 +103,1 @@ }));

exports.BottomNavigationTab = BottomNavigationTab;
//# sourceMappingURL=bottom-navigation.android.js.map

@@ -5,15 +5,21 @@ "use strict";

var properties_1 = require("tns-core-modules/ui/core/properties");
var observable_1 = require("tns-core-modules/data/observable");
var style_1 = require("tns-core-modules/ui/styling/style");
var color_1 = require("tns-core-modules/color");
var view_base_1 = require("tns-core-modules/ui/core/view-base");
function OnTabPressedEventData() { }
exports.OnTabPressedEventData = OnTabPressedEventData;
function OnTabPressedEventData_tsickle_Closure_declarations() {
OnTabPressedEventData.prototype.index;
}
function OnTabSelectedEventData() { }
exports.OnTabSelectedEventData = OnTabSelectedEventData;
function OnTabSelectedEventData_tsickle_Closure_declarations() {
OnTabSelectedEventData.prototype.oldIndex;
OnTabSelectedEventData.prototype.newIndex;
}
var BottomNavigationBase = (function (_super) {
__extends(BottomNavigationBase, _super);
function BottomNavigationBase() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.selectedTabIndex = 0;
_this.activeColor = 'blue';
_this.inactiveColor = 'gray';
_this.backgroundColor = 'white';
_this.keyLineColor = '#eeeeee';
return _this;
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -25,2 +31,10 @@ BottomNavigationBase.prototype.selectTab = function (index) {

};
BottomNavigationBase.prototype.onTabPressed = function (index) {
var eventData = {
eventName: 'tabPressed',
object: this,
index: index
};
this.notify(eventData);
};
BottomNavigationBase.prototype.onTabSelected = function (index) {

@@ -33,7 +47,4 @@ var eventData = {

};
if (this.tabs[index].selectable) {
this.selectedTabIndex = index;
}
this.selectedTabIndex = index;
this.notify(eventData);
return this.tabs[index].selectable;
};

@@ -43,5 +54,5 @@ BottomNavigationBase.prototype._addChildFromBuilder = function (name, value) {

if (!this.tabs) {
this.tabs = [];
this.tabs = ([]);
}
this.tabs.push(value);
this.tabs.push((value));
}

@@ -52,2 +63,11 @@ };

exports.BottomNavigationBase = BottomNavigationBase;
function BottomNavigationBase_tsickle_Closure_declarations() {
BottomNavigationBase.prototype.tabs;
BottomNavigationBase.prototype.selectedTabIndex;
BottomNavigationBase.prototype.activeColor;
BottomNavigationBase.prototype.inactiveColor;
BottomNavigationBase.prototype.backgroundColor;
BottomNavigationBase.prototype.keyLineColor;
BottomNavigationBase.prototype.selectTabNative = function (index) { };
}
exports.tabsProperty = new properties_1.Property({

@@ -104,3 +124,2 @@ name: 'tabs',

function BottomNavigationTabBase(title, icon, selectable, parent) {
this._selectable = true;
this._title = title;

@@ -141,3 +160,3 @@ this._icon = icon;

get: function () {
return view_base_1.booleanConverter(this._selectable);
return view_base_1.booleanConverter((this._selectable));
},

@@ -165,2 +184,7 @@ set: function (value) {

exports.BottomNavigationTabBase = BottomNavigationTabBase;
//# sourceMappingURL=bottom-navigation.common.js.map
function BottomNavigationTabBase_tsickle_Closure_declarations() {
BottomNavigationTabBase.prototype._title;
BottomNavigationTabBase.prototype._icon;
BottomNavigationTabBase.prototype._selectable;
BottomNavigationTabBase.prototype._parent;
}

@@ -8,2 +8,3 @@ "use strict";

var application_1 = require("tns-core-modules/application");
var view_1 = require("tns-core-modules/ui/core/view/view");
var BottomNavigationDelegate = (function (_super) {

@@ -15,14 +16,28 @@ __extends(BottomNavigationDelegate, _super);

BottomNavigationDelegate.initWithOwner = function (owner) {
var delegate = BottomNavigationDelegate.new();
var delegate = ((BottomNavigationDelegate.new()));
delegate._owner = owner;
return delegate;
};
BottomNavigationDelegate.prototype.onTabSelected = function (index) {
var bar = this._owner.get();
bar.onTabSelected(index);
BottomNavigationDelegate.prototype.bottomNavigationBarDidSelectItem = function (navigationBar, item) {
var bottomNavigation = this._owner.get();
if (bottomNavigation.selectedTabIndex === item.tag) {
return;
}
bottomNavigation.onTabSelected(item.tag);
};
BottomNavigationDelegate.ObjCProtocols = [MiniTabBarDelegate];
BottomNavigationDelegate.prototype.bottomNavigationBarShouldSelectItem = function (bottomNavigationBar, item) {
var bottomNavigation = this._owner.get();
var bottomNavigationTab = bottomNavigation.tabs[item.tag];
if (!bottomNavigationTab.selectable) {
bottomNavigation.onTabPressed(item.tag);
}
return bottomNavigationTab.selectable;
};
return BottomNavigationDelegate;
}(NSObject));
exports.BottomNavigationDelegate = BottomNavigationDelegate;
function BottomNavigationDelegate_tsickle_Closure_declarations() {
BottomNavigationDelegate.ObjCProtocols;
BottomNavigationDelegate.prototype._owner;
}
var BottomNavigation = (function (_super) {

@@ -42,17 +57,9 @@ __extends(BottomNavigation, _super);

this._delegate = BottomNavigationDelegate.initWithOwner(new WeakRef(this));
this.nativeView = new MiniTabBar({ items: null });
var bottomSafeArea = 0;
if (application_1.ios.window.safeAreaInsets) {
bottomSafeArea = application_1.ios.window.safeAreaInsets.bottom;
}
var bottomBarHeight = 56 + bottomSafeArea;
this.nativeView.frame = CGRectMake(0, platform_1.screen.mainScreen.heightDIPs - bottomBarHeight, platform_1.screen.mainScreen.widthDIPs, bottomBarHeight);
this.nativeView = MDCBottomNavigationBar.alloc().init();
return this.nativeView;
};
BottomNavigation.prototype.initNativeView = function () {
this.nativeView.tintColor = new color_1.Color(this.activeColor).ios;
this.nativeView.inactiveColor = new color_1.Color(this.inactiveColor).ios;
this.nativeView.backgroundColor = new color_1.Color(this.backgroundColor).ios;
this.nativeView.keyLine.backgroundColor = new color_1.Color(this.keyLineColor).ios;
this.nativeView.backgroundBlurEnabled = false;
this.nativeView.selectedItemTintColor = new color_1.Color(this.activeColor).ios;
this.nativeView.unselectedItemTintColor = new color_1.Color(this.inactiveColor).ios;
this.nativeView.barTintColor = new color_1.Color(this.backgroundColor).ios;
};

@@ -66,2 +73,17 @@ BottomNavigation.prototype.disposeNativeView = function () {

};
BottomNavigation.prototype.layoutNativeView = function (left, top, right, bottom) {
if (!this.nativeViewProtected) {
return;
}
var bottomSafeArea = 0;
if (application_1.ios.window.safeAreaInsets) {
bottomSafeArea = application_1.ios.window.safeAreaInsets.bottom;
}
var viewSize = CGSizeMake(platform_1.screen.mainScreen.widthDIPs, platform_1.screen.mainScreen.heightDIPs);
var nativeViewSize = this.nativeView.sizeThatFits(viewSize);
var bottomBarHeight = nativeViewSize.height + bottomSafeArea;
var nativeView = this.nativeViewProtected;
var frame = CGRectMake(0, view_1.layout.toDeviceIndependentPixels(top), viewSize.width, bottomBarHeight);
((this))._setNativeViewFrame(nativeView, frame);
};
BottomNavigation.prototype.createTabs = function (tabs) {

@@ -71,12 +93,6 @@ if (!this.tabs) {

}
var bottomNavigationTabs = [];
for (var _i = 0, tabs_1 = tabs; _i < tabs_1.length; _i++) {
var tab = tabs_1[_i];
tab.parent = new WeakRef(this);
var miniTabBarItem = new MiniTabBarItem({ title: tab.title, icon: image_source_1.fromResource(tab.icon).ios });
miniTabBarItem.selectable = tab.selectable;
bottomNavigationTabs.push(miniTabBarItem);
}
this.nativeView.setTabs(bottomNavigationTabs);
this.nativeView.selectItemAnimated(this.selectedTabIndex, true);
var toUITabBarItem = function (tab, tag) { return UITabBarItem.alloc().initWithTitleImageTag(tab.title, image_source_1.fromResource(tab.icon).ios, tag); };
var bottomNavigationTabs = tabs.map(toUITabBarItem);
this.nativeView.items = bottomNavigationTabs;
this.nativeView.selectedItem = bottomNavigationTabs[this.selectedTabIndex];
};

@@ -90,28 +106,25 @@ BottomNavigation.prototype[bottom_navigation_common_1.tabsProperty.getDefault] = function () {

BottomNavigation.prototype[bottom_navigation_common_1.activeColorProperty.setNative] = function (activeColor) {
this.nativeView.tintColor = new color_1.Color(activeColor).ios;
this.nativeView.selectedItemTintColor = new color_1.Color(activeColor).ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.activeColorCssProperty.setNative] = function (activeColor) {
this.nativeView.tintColor = activeColor.ios;
this.nativeView.selectedItemTintColor = activeColor.ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.inactiveColorProperty.setNative] = function (inactiveColor) {
this.nativeView.inactiveColor = new color_1.Color(inactiveColor).ios;
this.nativeView.unselectedItemTintColor = new color_1.Color(inactiveColor).ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.inactiveColorCssProperty.setNative] = function (inactiveColor) {
this.nativeView.inactiveColor = inactiveColor.ios;
this.nativeView.unselectedItemTintColor = inactiveColor.ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.backgroundColorProperty.setNative] = function (backgroundColor) {
this.nativeView.backgroundColor = new color_1.Color(backgroundColor).ios;
this.nativeView.barTintColor = new color_1.Color(backgroundColor).ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.backgroundColorCssProperty.setNative] = function (backgroundColor) {
this.nativeView.backgroundColor = backgroundColor.ios;
this.nativeView.barTintColor = backgroundColor.ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.keyLineColorProperty.setNative] = function (keyLineColor) {
console.log('seas', keyLineColor);
this.nativeView.keyLine.backgroundColor = new color_1.Color(keyLineColor).ios;
};
BottomNavigation.prototype[bottom_navigation_common_1.keyLineColorCssProperty.setNative] = function (keyLineColor) {
this.nativeView.keyLine.backgroundColor = keyLineColor.ios;
};
BottomNavigation.prototype.selectTabNative = function (index) {
this.nativeView.selectItemAnimated(index, true);
this.nativeView.selectedItem = this.nativeView.items[index];
};

@@ -121,2 +134,5 @@ return BottomNavigation;

exports.BottomNavigation = BottomNavigation;
function BottomNavigation_tsickle_Closure_declarations() {
BottomNavigation.prototype._delegate;
}
var BottomNavigationTab = (function (_super) {

@@ -130,2 +146,1 @@ __extends(BottomNavigationTab, _super);

exports.BottomNavigationTab = BottomNavigationTab;
//# sourceMappingURL=bottom-navigation.ios.js.map
import { EventData } from 'tns-core-modules/data/observable';
import { AddChildFromBuilder, View } from 'tns-core-modules/ui/core/view';
export declare interface OnTabPressedEventData extends EventData {
index: number;
}
export declare interface OnTabSelectedEventData extends EventData {

@@ -5,0 +9,0 @@ oldIndex: number;

{
"name": "nativescript-bottom-navigation",
"version": "1.3.0",
"version": "1.4.0",
"description": "Nativescript plugin to add a bottom navigation component for Android & iOS",

@@ -16,3 +16,3 @@ "main": "bottom-navigation",

"ngc": "node --max-old-space-size=8192 ./node_modules/.bin/ngc",
"build": "npm i && tsc",
"build": "npm i && tsc && npm run ngc",
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'",

@@ -72,5 +72,3 @@ "prepublishOnly": "npm run build",

"tslint": "~5.4.3"
},
"dependencies": {},
"bootstrapper": "nativescript-plugin-seed"
}
}
# Nativescript Bottom Navigation
Nativescript plugin for Android & iOS to have the Bottom Navigation bar.
Nativescript plugin for Android & iOS to have the Bottom Navigation bar following the Material Design Guidelines.

@@ -10,5 +10,13 @@ [![npm](https://img.shields.io/npm/v/nativescript-bottom-navigation.svg)](https://www.npmjs.com/package/nativescript-bottom-navigation) [![npm](https://img.shields.io/npm/dt/nativescript-bottom-navigation.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-bottom-navigation) [![Build Status](https://travis-ci.org/henrychavez/nativescript-bottom-navigation.svg?branch=master)](https://travis-ci.org/henrychavez/nativescript-bottom-navigation)

## Contents
1. [Installation](#installation)
2. [Usage with Javascript](#usage)
3. [Usage with Angular](#angular)
4. [Usage with Vue](#vue)
5. [Css Styling](#css-styling)
6. [API](#api)
## Prerequisites / Requirements
You need the version of NS3 to use this plugin.
You need the version of NS3 or later to use this plugin.

@@ -159,2 +167,3 @@ ## Installation

(tabSelected)="onBottomNavigationTabSelected($event)"
(tabPressed)="onBottomNavigationTabPressed($event)"
row="1"></BottomNavigation>

@@ -176,2 +185,3 @@ </GridLayout>

(tabSelected)="onBottomNavigationTabSelected($event)"
(tabPressed)="onBottomNavigationTabPressed($event)"
row="1">

@@ -187,3 +197,3 @@ <BottomNavigationTab title="First" icon="ic_home"></BottomNavigationTab>

import { Component, OnInit } from "@angular/core";
import { BottomNavigation, BottomNavigationTab, OnTabSelectedEventData } from 'nativescript-bottom-navigation';
import { BottomNavigation, BottomNavigationTab, OnTabPressedEventData, OnTabSelectedEventData } from 'nativescript-bottom-navigation';

@@ -205,2 +215,6 @@ @Component(

onBottomNavigationTabPressed(args: OnTabPressedEventData): void {
console.log(`Tab pressed: ${args.index}`);
}
onBottomNavigationTabSelected(args: OnTabSelectedEventData): void {

@@ -212,2 +226,33 @@ console.log(`Tab selected: ${args.oldIndex}`);

#### Vue
If you want to use this plugin with Vue, the only thing you have to do is register de element in your `app.js` or `main.js` as I'll show you below:
```javascript
Vue.registerElement('BottomNavigation', () => require('nativescript-bottom-navigation').BottomNavigation);
Vue.registerElement('BottomNavigationTab', () => require('nativescript-bottom-navigation').BottomNavigationTab);
```
This will register `BottomNavigation` and `BottomNavigationTab` to your `Vue` instance and now you can use the plugin as follows:
```xml
<GridLayout rows="*, auto">
<StackLayout row="0">
<Label text="content"></Label>
</StackLayout>
<BottomNavigation activeColor="red"
inactiveColor="yellow"
backgroundColor="black"
keyLineColor="black"
@tabSelected="onBottomNavigationTabSelected"
row="1">
<BottomNavigationTab title="First" icon="ic_home" />
<BottomNavigationTab title="Second" icon="ic_view_list" />
<BottomNavigationTab title="Third" icon="ic_menu" />
</BottomNavigation>
</GridLayout>
```
You can find more information of how to use nativescript plugins with Vue [Here!](https://nativescript-vue.org/en/docs/getting-started/nativescript-plugins/)
#### CSS Styling

@@ -222,3 +267,2 @@

tab-background-color: blue;
tab-keyline-color: blue;
}

@@ -233,2 +277,3 @@ ```

** properties (bindable) = properties settable thew XML/HTML
** events = event properties settable thew XML/HTML
** properties (internal) = properties settable thew JS/TS instance

@@ -246,4 +291,10 @@

| backgroundColor | false | "white" | `String` | Color of the BottomNavigation background |
| keyLineColor | false | "#eeeeee" | `String` | Color of the BottomNavigation keyLine (Top border) |
#### Events
| Property | Required | Default | Type | Description |
| --- | --- | --- | --- | --- |
| tabSelected | false | null | `function ($event: OnTabSelectedEventData) {}` | Function fired every time the user select a new tab that receive an event object |
| tabPressed | false | null | `function ($event: OnTabPressedEventData) {}` | Function fired every time the user tap a tab with `selectable: false` that receive an event object |
#### Properties (internal)

@@ -250,0 +301,0 @@

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