@nativescript-community/ui-bottomnavigationbar 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,239 @@
1
+ var BottomNavigationBarBase_1;
2
+ import { CSSType, CoercibleProperty, Color, CssProperty, Property, Style, View, booleanConverter } from '@nativescript/core';
3
+ import { cssProperty } from '@nativescript-community/ui-core';
4
+ import { observeScrollDirection } from '@nativescript-community/ui-core/scroll-hide';
5
+ /**
6
+ * Enum for Title Visibility options
7
+ *
8
+ * @export
9
+ * @enum {number}
10
+ */
11
+ export var TitleVisibility;
12
+ (function (TitleVisibility) {
13
+ TitleVisibility[TitleVisibility["selected"] = 0] = "selected";
14
+ TitleVisibility[TitleVisibility["always"] = 1] = "always";
15
+ TitleVisibility[TitleVisibility["never"] = 2] = "never";
16
+ })(TitleVisibility || (TitleVisibility = {}));
17
+ export const selectedTabIndexProperty = new CoercibleProperty({
18
+ name: 'selectedTabIndex',
19
+ defaultValue: -1,
20
+ affectsLayout: global.isIOS,
21
+ valueChanged: (target, oldValue, newValue) => {
22
+ target.onSelectedTabIndexChanged(oldValue, newValue);
23
+ },
24
+ coerceValue: (target, value) => {
25
+ const items = target.items;
26
+ if (items) {
27
+ const max = items.length - 1;
28
+ if (value < 0) {
29
+ value = 0;
30
+ }
31
+ if (value > max) {
32
+ value = max;
33
+ }
34
+ }
35
+ else {
36
+ value = -1;
37
+ }
38
+ return value;
39
+ },
40
+ valueConverter: (v) => parseInt(v, 10)
41
+ });
42
+ let BottomNavigationBarBase = BottomNavigationBarBase_1 = class BottomNavigationBarBase extends View {
43
+ constructor() {
44
+ super(...arguments);
45
+ this.titleVisibility = TitleVisibility.always;
46
+ this._hidden = false;
47
+ this._items = [];
48
+ }
49
+ /** @internal */
50
+ observeScroll(target) {
51
+ this._stopObservingScroll?.();
52
+ this._stopObservingScroll = target
53
+ ? observeScrollDirection(target, (direction) => {
54
+ const hidden = direction === 'down';
55
+ if (hidden !== this._hidden) {
56
+ this._hidden = hidden;
57
+ this.animate({ translate: { x: 0, y: hidden ? this.getActualSize().height + 64 : 0 }, duration: 200 }).catch(() => null);
58
+ }
59
+ })
60
+ : null;
61
+ }
62
+ get items() {
63
+ return this._items;
64
+ }
65
+ onUnloaded() {
66
+ this._stopObservingScroll?.();
67
+ this._stopObservingScroll = null;
68
+ super.onUnloaded();
69
+ }
70
+ onLoaded() {
71
+ super.onLoaded();
72
+ if (this.hideOnScroll && !this._stopObservingScroll) {
73
+ this.observeScroll(this.hideOnScroll);
74
+ }
75
+ this._items.forEach((child) => {
76
+ this.loadView(child);
77
+ return true;
78
+ });
79
+ }
80
+ selectTab(index) {
81
+ if (index === this.selectedTabIndex) {
82
+ return;
83
+ }
84
+ this.selectTabNative(index);
85
+ }
86
+ _emitTabPressed(index) {
87
+ const eventData = {
88
+ eventName: BottomNavigationBarBase_1.tabPressedEvent,
89
+ object: this,
90
+ index
91
+ };
92
+ this.notify(eventData);
93
+ if (this.autoClearBadge) {
94
+ this.removeBadge(index);
95
+ }
96
+ }
97
+ _emitTabSelected(index) {
98
+ this.onSelectedTabIndexChanged(this.selectedTabIndex, index);
99
+ if (this.autoClearBadge) {
100
+ this.removeBadge(index);
101
+ }
102
+ }
103
+ _emitTabReselected(index) {
104
+ const eventData = {
105
+ eventName: BottomNavigationBarBase_1.tabReselectedEvent,
106
+ object: this,
107
+ index
108
+ };
109
+ this.notify(eventData);
110
+ }
111
+ _addChildFromBuilder(name, value) {
112
+ if (value instanceof BottomNavigationTabBase) {
113
+ if (!this._items) {
114
+ this._items = [];
115
+ }
116
+ this._items.push(value);
117
+ }
118
+ }
119
+ showBadge(index, value) {
120
+ this._items[index] && this._items[index].showBadge(value);
121
+ }
122
+ removeBadge(index) {
123
+ this._items[index] && this._items[index].removeBadge();
124
+ }
125
+ [selectedTabIndexProperty.setNative](value) {
126
+ this.selectTab(value);
127
+ }
128
+ onSelectedTabIndexChanged(oldIndex, newIndex) {
129
+ this.selectedTabIndex = newIndex;
130
+ // to be overridden in platform specific files
131
+ this.notify({
132
+ eventName: BottomNavigationBarBase_1.tabSelectedEvent,
133
+ object: this,
134
+ oldIndex,
135
+ newIndex
136
+ });
137
+ }
138
+ };
139
+ BottomNavigationBarBase.tabPressedEvent = 'tabPressed';
140
+ BottomNavigationBarBase.tabSelectedEvent = 'tabSelected';
141
+ BottomNavigationBarBase.tabReselectedEvent = 'tabReselected';
142
+ __decorate([
143
+ cssProperty
144
+ ], BottomNavigationBarBase.prototype, "activeColor", void 0);
145
+ __decorate([
146
+ cssProperty
147
+ ], BottomNavigationBarBase.prototype, "inactiveColor", void 0);
148
+ __decorate([
149
+ cssProperty
150
+ ], BottomNavigationBarBase.prototype, "badgeColor", void 0);
151
+ __decorate([
152
+ cssProperty
153
+ ], BottomNavigationBarBase.prototype, "badgeTextColor", void 0);
154
+ BottomNavigationBarBase = BottomNavigationBarBase_1 = __decorate([
155
+ CSSType('BottomNavigationBar')
156
+ ], BottomNavigationBarBase);
157
+ export { BottomNavigationBarBase };
158
+ export const hideOnScrollProperty = new Property({
159
+ name: 'hideOnScroll',
160
+ valueChanged: (target, oldValue, newValue) => target.observeScroll(newValue)
161
+ });
162
+ export const tabsProperty = new Property({
163
+ name: 'tabs',
164
+ affectsLayout: true
165
+ });
166
+ tabsProperty.register(BottomNavigationBarBase);
167
+ hideOnScrollProperty.register(BottomNavigationBarBase);
168
+ export const titleVisibilityProperty = new Property({
169
+ name: 'titleVisibility',
170
+ equalityComparer: (x, y) => x === y,
171
+ affectsLayout: true,
172
+ valueConverter: (v) => (typeof v === 'string' ? TitleVisibility[v.toLowerCase()] : v)
173
+ });
174
+ titleVisibilityProperty.register(BottomNavigationBarBase);
175
+ export const autoClearBadgeProperty = new Property({
176
+ name: 'autoClearBadge',
177
+ defaultValue: true,
178
+ valueConverter: booleanConverter
179
+ });
180
+ autoClearBadgeProperty.register(BottomNavigationBarBase);
181
+ export const activeColorCssProperty = new CssProperty({
182
+ name: 'activeColor',
183
+ cssName: 'active-color',
184
+ equalityComparer: Color.equals,
185
+ valueConverter: (v) => new Color(v)
186
+ });
187
+ activeColorCssProperty.register(Style);
188
+ export const inactiveColorCssProperty = new CssProperty({
189
+ name: 'inactiveColor',
190
+ cssName: 'inactive-color',
191
+ equalityComparer: Color.equals,
192
+ valueConverter: (v) => new Color(v)
193
+ });
194
+ inactiveColorCssProperty.register(Style);
195
+ export const badgeColorCssProperty = new CssProperty({
196
+ name: 'badgeColor',
197
+ cssName: 'badge-color',
198
+ equalityComparer: Color.equals,
199
+ valueConverter: (v) => new Color(v)
200
+ });
201
+ badgeColorCssProperty.register(Style);
202
+ export const badgeTextColorCssProperty = new CssProperty({
203
+ name: 'badgeTextColor',
204
+ cssName: 'badge-text-color',
205
+ equalityComparer: Color.equals,
206
+ valueConverter: (v) => new Color(v)
207
+ });
208
+ badgeTextColorCssProperty.register(Style);
209
+ selectedTabIndexProperty.register(BottomNavigationBarBase);
210
+ let BottomNavigationTabBase = class BottomNavigationTabBase extends View {
211
+ };
212
+ __decorate([
213
+ cssProperty
214
+ ], BottomNavigationTabBase.prototype, "title", void 0);
215
+ __decorate([
216
+ cssProperty
217
+ ], BottomNavigationTabBase.prototype, "icon", void 0);
218
+ __decorate([
219
+ cssProperty
220
+ ], BottomNavigationTabBase.prototype, "activeColor", void 0);
221
+ __decorate([
222
+ cssProperty
223
+ ], BottomNavigationTabBase.prototype, "inactiveColor", void 0);
224
+ BottomNavigationTabBase = __decorate([
225
+ CSSType('BottomNavigationTab')
226
+ ], BottomNavigationTabBase);
227
+ export { BottomNavigationTabBase };
228
+ export const isSelectableProperty = new Property({
229
+ name: 'isSelectable',
230
+ defaultValue: true,
231
+ valueConverter: booleanConverter
232
+ });
233
+ isSelectableProperty.register(BottomNavigationTabBase);
234
+ export const iconProperty = new Property({
235
+ name: 'icon',
236
+ affectsLayout: true
237
+ });
238
+ iconProperty.register(BottomNavigationTabBase);
239
+ //# sourceMappingURL=index-common.js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AAW;sDAAe;AACd;IAAZ,WAAW;qDAA4B;AAG3B;IAAZ,WAAW;4DAAoB;AACnB;IAAZ,WAAW;8DAAsB;AANhB,uBAAuB;IAD5C,OAAO,CAAC,qBAAqB,CAAC;GACT,uBAAuB,CAuB5C;;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,QAAQ,CAAmC;IAC/E,IAAI,EAAE,cAAc;IACpB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,gBAAgB;CACnC,CAAC,CAAC;AAEH,oBAAoB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAuC;IAC3E,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,IAAI;CACtB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Color } from '@nativescript/core';
2
+ import { BottomNavigationBarBase, BottomNavigationTabBase, TitleVisibility, activeColorCssProperty, iconProperty, inactiveColorCssProperty, tabsProperty, titleVisibilityProperty } from './index-common';
3
+ declare type OnNavigationItemSelectedListener = com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener;
4
+ declare type OnNavigationItemReselectedListener = com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener;
5
+ export declare class BottomNavigationBar extends BottomNavigationBarBase {
6
+ [tabsProperty.setNative]: (tabs: BottomNavigationTab[]) => void;
7
+ [titleVisibilityProperty.setNative]: (titleVisibility: TitleVisibility) => void;
8
+ [activeColorCssProperty.setNative]: (activeColor: Color) => void;
9
+ [inactiveColorCssProperty.setNative]: (inactiveColor: Color) => void;
10
+ nativeViewProtected: com.google.android.material.bottomnavigation.BottomNavigationView;
11
+ _items: BottomNavigationTab[];
12
+ reselectListener: OnNavigationItemReselectedListener;
13
+ selectListener: OnNavigationItemSelectedListener;
14
+ height: number;
15
+ createNativeView(): com.google.android.material.bottomnavigation.BottomNavigationView;
16
+ initNativeView(): void;
17
+ disposeNativeView(): void;
18
+ showBadge(index: number, value?: number): void;
19
+ removeBadge(index: number): void;
20
+ protected createTabs(tabs: BottomNavigationTab[] | undefined): void;
21
+ protected selectTabNative(index: number): void;
22
+ }
23
+ export declare class BottomNavigationTab extends BottomNavigationTabBase {
24
+ [iconProperty.setNative]: (iconSource: any) => any;
25
+ [activeColorCssProperty.setNative]: (activeColor: Color) => void;
26
+ [inactiveColorCssProperty.setNative]: (inactiveColor: Color) => void;
27
+ nativeViewProtected: android.view.MenuItem;
28
+ index: number;
29
+ _isPaddingRelative: boolean;
30
+ createNativeView(): globalAndroid.view.MenuItem;
31
+ initNativeView(): void;
32
+ showBadge(value?: any): void;
33
+ removeBadge(): void;
34
+ }
35
+ export {};
@@ -0,0 +1,248 @@
1
+ import { state, stateSets } from '@nativescript-community/ui-core/android/utils';
2
+ import { Color, ImageSource, Utils } from '@nativescript/core';
3
+ import { BottomNavigationBarBase, BottomNavigationTabBase, activeColorCssProperty, iconProperty, inactiveColorCssProperty, tabsProperty, titleVisibilityProperty } from './index-common';
4
+ // eslint-disable-next-line no-redeclare
5
+ let OnTabSelectedlistener;
6
+ const getOnTabSelectedlistener = () => {
7
+ if (OnTabSelectedlistener) {
8
+ return OnTabSelectedlistener;
9
+ }
10
+ var OnTabSelectedlistenerImpl = /** @class */ (function (_super) {
11
+ __extends(OnTabSelectedlistenerImpl, _super);
12
+ function OnTabSelectedlistenerImpl(owner) {
13
+ var _this = _super.call(this) || this;
14
+ _this.owner = owner;
15
+ // necessary when extending TypeScript constructors
16
+ return global.__native(_this);
17
+ }
18
+ OnTabSelectedlistenerImpl.prototype.onNavigationItemSelected = function (menuItem) {
19
+ var _a;
20
+ var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get();
21
+ if (owner) {
22
+ var index = menuItem.getItemId();
23
+ var bottomNavigationTab = owner.items[index];
24
+ if (bottomNavigationTab.isSelectable) {
25
+ owner._emitTabSelected(index);
26
+ }
27
+ else {
28
+ owner._emitTabPressed(index);
29
+ }
30
+ return bottomNavigationTab.isSelectable;
31
+ }
32
+ return false;
33
+ };
34
+ var _a;
35
+ OnTabSelectedlistenerImpl = __decorate([
36
+ Interfaces([com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener]),
37
+ __metadata("design:paramtypes", [typeof (_a = typeof WeakRef !== "undefined" && WeakRef) === "function" ? _a : Object])
38
+ ], OnTabSelectedlistenerImpl);
39
+ return OnTabSelectedlistenerImpl;
40
+ }(java.lang.Object));
41
+ OnTabSelectedlistener = OnTabSelectedlistenerImpl;
42
+ return OnTabSelectedlistener;
43
+ };
44
+ // eslint-disable-next-line no-redeclare
45
+ let OnTabReselectedListener;
46
+ const getOnTabReselectedListener = () => {
47
+ if (OnTabReselectedListener) {
48
+ return OnTabReselectedListener;
49
+ }
50
+ var OnTabReselectedListenerImpl = /** @class */ (function (_super) {
51
+ __extends(OnTabReselectedListenerImpl, _super);
52
+ function OnTabReselectedListenerImpl(owner) {
53
+ var _this = _super.call(this) || this;
54
+ _this.owner = owner;
55
+ // necessary when extending TypeScript constructors
56
+ return global.__native(_this);
57
+ }
58
+ OnTabReselectedListenerImpl.prototype.onNavigationItemReselected = function (menuItem) {
59
+ var _a, _b;
60
+ (_b = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get()) === null || _b === void 0 ? void 0 : _b._emitTabReselected(menuItem.getItemId());
61
+ };
62
+ var _a;
63
+ OnTabReselectedListenerImpl = __decorate([
64
+ Interfaces([com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener]),
65
+ __metadata("design:paramtypes", [typeof (_a = typeof WeakRef !== "undefined" && WeakRef) === "function" ? _a : Object])
66
+ ], OnTabReselectedListenerImpl);
67
+ return OnTabReselectedListenerImpl;
68
+ }(java.lang.Object));
69
+ OnTabReselectedListener = OnTabReselectedListenerImpl;
70
+ return OnTabReselectedListener;
71
+ };
72
+ function createColorStateList(activeColor, inactiveColor) {
73
+ const stateChecked = Array.create('int', 1);
74
+ stateChecked[0] = state.checked;
75
+ const stateUnChecked = Array.create('int', 0);
76
+ const states = Array.create('[I', 2);
77
+ states[0] = stateChecked;
78
+ states[1] = stateUnChecked;
79
+ const colors = Array.create('int', 2);
80
+ colors[0] = activeColor;
81
+ colors[1] = inactiveColor;
82
+ return new android.content.res.ColorStateList(states, colors);
83
+ }
84
+ export class BottomNavigationBar extends BottomNavigationBarBase {
85
+ constructor() {
86
+ super(...arguments);
87
+ // default height: the one of the Material 3 NavigationBar
88
+ this.height = 80;
89
+ }
90
+ createNativeView() {
91
+ return new com.google.android.material.bottomnavigation.BottomNavigationView(this._context);
92
+ }
93
+ initNativeView() {
94
+ super.initNativeView();
95
+ const OnTabReselectedListener = getOnTabReselectedListener();
96
+ const OnTabSelectedListener = getOnTabSelectedlistener();
97
+ const that = new WeakRef(this);
98
+ this.reselectListener = new OnTabReselectedListener(that);
99
+ this.selectListener = new OnTabSelectedListener(that);
100
+ this.nativeViewProtected.setOnNavigationItemReselectedListener(this.reselectListener);
101
+ this.nativeViewProtected.setOnNavigationItemSelectedListener(this.selectListener);
102
+ // Create the tabs before setting the default values for each tab
103
+ // We call this method here to create the tabs defined in the xml
104
+ this.createTabs(this._items);
105
+ this.selectTabNative(this.selectedTabIndex);
106
+ }
107
+ disposeNativeView() {
108
+ this.nativeViewProtected.setOnNavigationItemReselectedListener(null);
109
+ this.nativeViewProtected.setOnNavigationItemSelectedListener(null);
110
+ this.reselectListener = null;
111
+ this.selectListener = null;
112
+ this._items.forEach((item) => this._removeView(item));
113
+ super.disposeNativeView();
114
+ }
115
+ showBadge(index, value) {
116
+ // showBadge method is available in v1.1.0-alpha07 of material components
117
+ // but NS team has the .d.ts for version 1
118
+ // that's why we need to cast the nativeView to any to avoid typing errors
119
+ const badge = this.nativeViewProtected.getOrCreateBadge(index);
120
+ if (this.badgeColor) {
121
+ badge.setBackgroundColor(this.badgeColor.android);
122
+ }
123
+ if (this.badgeTextColor) {
124
+ badge.setBadgeTextColor(this.badgeTextColor.android);
125
+ }
126
+ if (value) {
127
+ badge.setNumber(value);
128
+ }
129
+ }
130
+ removeBadge(index) {
131
+ // removeBadge method is available in v1.1.0-alpha07 of material components
132
+ // but NS team has the .d.ts for version 1
133
+ // that's why we need to cast the nativeView to any to avoid typing errors
134
+ this.nativeViewProtected.removeBadge(index);
135
+ }
136
+ [tabsProperty.setNative](tabs) {
137
+ this.createTabs(tabs);
138
+ }
139
+ [titleVisibilityProperty.setNative](titleVisibility) {
140
+ this.nativeViewProtected.setLabelVisibilityMode(titleVisibility);
141
+ }
142
+ [activeColorCssProperty.setNative](activeColor) {
143
+ const color1 = activeColor instanceof Color ? activeColor.android : activeColor;
144
+ const color2 = this.inactiveColor instanceof Color ? this.inactiveColor.android : this.nativeViewProtected.getItemTextColor().getColorForState(stateSets.BACKGROUND_DEFAULT_STATE_2, color1);
145
+ const colorStateList = createColorStateList(color1, color2);
146
+ this.nativeViewProtected.setItemTextColor(colorStateList);
147
+ this.nativeViewProtected.setItemIconTintList(colorStateList);
148
+ }
149
+ [inactiveColorCssProperty.setNative](inactiveColor) {
150
+ const color2 = inactiveColor instanceof Color ? inactiveColor.android : inactiveColor;
151
+ const color1 = this.activeColor instanceof Color ? this.activeColor.android : this.nativeViewProtected.getItemTextColor().getColorForState(stateSets.FOCUSED_STATE_SET, color2);
152
+ const colorStateList = createColorStateList(color1, color2);
153
+ this.nativeViewProtected.setItemTextColor(colorStateList);
154
+ this.nativeViewProtected.setItemIconTintList(colorStateList);
155
+ }
156
+ createTabs(tabs) {
157
+ const bottomNavigationTabs = this.nativeViewProtected.getMenu();
158
+ if (bottomNavigationTabs.size() > 0) {
159
+ bottomNavigationTabs.clear();
160
+ }
161
+ if (tabs) {
162
+ this._items = tabs;
163
+ }
164
+ this._items.forEach((item, index) => {
165
+ // the create nativeView will actually add the item to the tab bar
166
+ item.index = index;
167
+ this._addView(item);
168
+ // const tab = item.nativeViewProtected;
169
+ // tab.setIcon(item.getNativeIcon());
170
+ });
171
+ }
172
+ selectTabNative(index) {
173
+ if (this.nativeViewProtected) {
174
+ const bottomNavigationTabs = this.nativeViewProtected.getMenu();
175
+ if (bottomNavigationTabs.size() === 0) {
176
+ return;
177
+ }
178
+ this.nativeViewProtected.setSelectedItemId(index);
179
+ }
180
+ this.selectedTabIndex = index;
181
+ }
182
+ }
183
+ // Bottom Navigation Tab
184
+ export class BottomNavigationTab extends BottomNavigationTabBase {
185
+ constructor() {
186
+ super(...arguments);
187
+ this.index = android.view.Menu.NONE;
188
+ this._isPaddingRelative = true; // trick because @nativescript/core expect us to be a view
189
+ }
190
+ createNativeView() {
191
+ const view = this.parent.nativeViewProtected.getMenu().add(android.view.Menu.NONE, this.index, android.view.Menu.NONE, this.title);
192
+ // trick because @nativescript/core expect us to be a view
193
+ view.defaultPaddings = { top: 0, left: 0, bottom: 0, right: 0 };
194
+ return view;
195
+ }
196
+ initNativeView() {
197
+ // override for super not to be called. isClickable does not exist on android.view.MenuItem
198
+ }
199
+ [iconProperty.setNative](iconSource) {
200
+ if (!iconSource) {
201
+ return null;
202
+ }
203
+ let is;
204
+ if (iconSource instanceof ImageSource) {
205
+ is = iconSource;
206
+ }
207
+ else if (Utils.isFontIconURI(iconSource)) {
208
+ const fontIconCode = iconSource.split('//')[1];
209
+ const font = this.style.fontInternal;
210
+ is = ImageSource.fromFontIconCodeSync(fontIconCode, font, new Color('white'));
211
+ }
212
+ else {
213
+ is = ImageSource.fromFileOrResourceSync(iconSource);
214
+ }
215
+ this.nativeViewProtected.setIcon(is ? new android.graphics.drawable.BitmapDrawable(is.android) : null);
216
+ }
217
+ showBadge(value) {
218
+ this.parent.showBadge(this.index, value);
219
+ }
220
+ removeBadge() {
221
+ this.parent.removeBadge(this.index);
222
+ }
223
+ [activeColorCssProperty.setNative](activeColor) {
224
+ // not working for now
225
+ const color1 = activeColor instanceof Color ? activeColor.android : activeColor;
226
+ const color2 = this.inactiveColor instanceof Color
227
+ ? this.inactiveColor.android
228
+ : this.nativeViewProtected.getIconTintList()
229
+ ? this.nativeViewProtected.getIconTintList().getColorForState(stateSets.BACKGROUND_DEFAULT_STATE_2, color1)
230
+ : 0;
231
+ const colorStateList = createColorStateList(color1, color2);
232
+ // this.nativeViewProtected.color(colorStateList); // can we set the text color?
233
+ this.nativeViewProtected.setIconTintList(colorStateList);
234
+ }
235
+ [inactiveColorCssProperty.setNative](inactiveColor) {
236
+ // not working for now
237
+ const color2 = inactiveColor instanceof Color ? inactiveColor.android : inactiveColor;
238
+ const color1 = this.activeColor instanceof Color
239
+ ? this.activeColor.android
240
+ : this.nativeViewProtected.getIconTintList()
241
+ ? this.nativeViewProtected.getIconTintList().getColorForState(stateSets.SELECTED_STATE_SET, color2)
242
+ : 0;
243
+ const colorStateList = createColorStateList(color1, color2);
244
+ // this.nativeViewProtected.setText(colorStateList); // can we set the text color?
245
+ this.nativeViewProtected.setIconTintList(colorStateList);
246
+ }
247
+ }
248
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/ui-bottomnavigationbar/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAkB,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EAEvB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EAC1B,MAAM,gBAAgB,CAAC;AASxB,wCAAwC;AACxC,IAAI,qBAA4C,CAAC;AAEjD,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAClC,IAAI,qBAAqB,EAAE,CAAC;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BD,qBAAqB,GAAG,yBAAyB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AI,CAAC,mBAAmB,CAAC,eAAe,EAAE;gBAC1C,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,0BAA0B,EAAE,MAAM,CAAC;gBAC3G,CAAC,CAAC,CAAC,CAAC;QACd,MAAM,cAAc,GAAG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5D,gFAAgF;QAChF,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAC7D,CAAC;IAED,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,aAAoB;QACrD,sBAAsB;QACtB,MAAM,MAAM,GAAG,aAAa,YAAY,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;QACtF,MAAM,MAAM,GACR,IAAI,CAAC,WAAW,YAAY,KAAK;YAC7B,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO;YAC1B,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE;gBAC1C,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC;gBACnG,CAAC,CAAC,CAAC,CAAC;QACd,MAAM,cAAc,GAAG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5D,kFAAkF;QAClF,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAC7D,CAAC;CACJ"}
package/index.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * BottomNavigationBar component: Material 3 NavigationBar on Android, native UITabBar on iOS
3
+ * @module @nativescript-community/ui-bottomnavigationbar
4
+ */
5
+
6
+ import { Color, EventData, ImageSource, View } from '@nativescript/core';
7
+ import { BottomNavigationBarBase, BottomNavigationTabBase, TabPressedEventData, TabReselectedEventData, TabSelectedEventData, TitleVisibility } from './index-common';
8
+
9
+ export { TabPressedEventData, TabReselectedEventData, TabSelectedEventData, TitleVisibility };
10
+
11
+ export declare class BottomNavigationBar extends BottomNavigationBarBase {
12
+ static tabPressedEvent: string;
13
+ static tabSelectedEvent: string;
14
+ static tabReselectedEvent: string;
15
+ readonly ios: any;
16
+ readonly android: any;
17
+ //@ts-ignore
18
+ readonly items: BottomNavigationTab[];
19
+ selectedTabIndex: number;
20
+ /** the scrolling view (collectionview, scrollview...): the bar slides out when the content scrolls down and comes back when it scrolls up */
21
+ hideOnScroll: View;
22
+ titleVisibility: TitleVisibility;
23
+ activeColor: Color;
24
+ inactiveColor: Color;
25
+ backgroundColor: Color;
26
+ autoClearBadge: Boolean;
27
+ selectTab(index: number): void;
28
+ showBadge(index: number, value?: number): void;
29
+ removeBadge(index: number): void;
30
+ on(event: 'tabPressed', callback: (args: TabPressedEventData) => void, thisArg?: any): void;
31
+ on(event: 'tabSelected', callback: (args: TabSelectedEventData) => void, thisArg?: any): void;
32
+ on(event: 'tabReselected', callback: (args: TabReselectedEventData) => void, thisArg?: any): void;
33
+
34
+ // Needed when 'on' method is overriden.
35
+ /**
36
+ * @hidden
37
+ */
38
+ on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void;
39
+ protected createTabs(tabs?: BottomNavigationTab[]): void;
40
+ protected selectTabNative(index: number): void;
41
+ }
42
+
43
+ export declare class BottomNavigationTab extends BottomNavigationTabBase {
44
+ title: string;
45
+ icon: ImageSource;
46
+ isSelectable: boolean;
47
+ getNativeIcon(): any;
48
+ showBadge(value?: number): void;
49
+ removeBadge(): void;
50
+ }
package/index.ios.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { Color, backgroundColorProperty } from '@nativescript/core';
2
+ import { BottomNavigationBarBase, BottomNavigationTabBase, TitleVisibility, activeColorCssProperty, badgeColorCssProperty, badgeTextColorCssProperty, iconProperty, inactiveColorCssProperty, tabsProperty, titleVisibilityProperty } from './index-common';
3
+ export declare class BottomNavigationBar extends BottomNavigationBarBase {
4
+ [tabsProperty.setNative]: (tabs: BottomNavigationTab[]) => void;
5
+ [titleVisibilityProperty.setNative]: (titleVisibility: TitleVisibility) => void;
6
+ [activeColorCssProperty.setNative]: (activeColor: Color) => void;
7
+ [inactiveColorCssProperty.setNative]: (inactiveColor: Color) => void;
8
+ [badgeColorCssProperty.setNative]: (color: Color) => void;
9
+ [badgeTextColorCssProperty.setNative]: (color: Color) => void;
10
+ [backgroundColorProperty.setNative]: (backgroundColor: Color) => void;
11
+ nativeViewProtected: UITabBar;
12
+ _items: BottomNavigationTab[];
13
+ private _delegate;
14
+ createNativeView(): Object;
15
+ initNativeView(): void;
16
+ disposeNativeView(): void;
17
+ layoutNativeView(left: number, top: number, right: number, bottom: number): void;
18
+ showBadge(index: number, value?: number): void;
19
+ removeBadge(index: number): void;
20
+ /**
21
+ * Applies the colors of the bar to the UITabBarAppearance (stacked, inline and compact inline layouts)
22
+ */
23
+ updateAppearance(): void;
24
+ /**
25
+ * `titleVisibility`: never hides the titles, selected only shows the title of the selected tab
26
+ */
27
+ updateTitles(): void;
28
+ protected createTabs(tabs: BottomNavigationTab[] | undefined): void;
29
+ protected selectTabNative(index: number): void;
30
+ _onNativeItemSelected(item: UITabBarItem): void;
31
+ }
32
+ export declare class BottomNavigationTab extends BottomNavigationTabBase {
33
+ [iconProperty.setNative]: (iconSource: any) => void;
34
+ [activeColorCssProperty.setNative]: (activeColor: Color) => void;
35
+ [inactiveColorCssProperty.setNative]: (inactiveColor: Color) => void;
36
+ nativeViewProtected: UITabBarItem;
37
+ private mTitleVisible;
38
+ createNativeView(): UITabBarItem;
39
+ getNativeIcon(): UIImage;
40
+ /**
41
+ * Colors of the icons: pre tinted (always original) images, the tint of the tab bar is ignored by the iOS 26 glass bar.
42
+ * Without colors the icon is a template image tinted by the system.
43
+ */
44
+ updateIcon(): void;
45
+ updateTitle(visible: boolean): void;
46
+ showBadge(value?: number): void;
47
+ removeBadge(): void;
48
+ }