@nativescript-community/ui-material-bottom-navigation 6.2.14 → 6.2.17

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.
package/index.ios.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { TabContentItem } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-content-item';
2
2
  import { TabNavigationBase } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-navigation-base';
3
+ import { TabsPosition } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-navigation/index-common';
3
4
  import { TabStrip } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-strip';
4
5
  import { TabStripItem } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-strip-item';
5
6
  import { Color, CoreTypes, Font, Property } from '@nativescript/core';
@@ -14,16 +15,17 @@ declare class UITabBarControllerImpl extends UITabBarController {
14
15
  }
15
16
  export declare const iosCustomPositioningProperty: Property<BottomNavigation, boolean>;
16
17
  export declare class BottomNavigation extends TabNavigationBase {
18
+ tabsPosition: TabsPosition;
17
19
  viewController: UITabBarControllerImpl;
18
20
  items: TabContentItem[];
19
- _ios: UITabBarControllerImpl;
20
- private _delegate;
21
- private _moreNavigationControllerDelegate;
22
- private _iconsCache;
23
- private _selectedItemColor;
24
- private _unSelectedItemColor;
21
+ private mDelegate;
22
+ private mMoreNavigationControllerDelegate;
23
+ private mIconsCache;
24
+ private mSelectedItemColor;
25
+ private mUnSelectedItemColor;
25
26
  iosCustomPositioning: boolean;
26
27
  constructor();
28
+ createNativeView(): UIView;
27
29
  initNativeView(): void;
28
30
  disposeNativeView(): void;
29
31
  onLoaded(): void;
package/index.ios.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { TabContentItem } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-content-item';
2
2
  import { TabNavigationBase, getIconSpecSize, itemsProperty, selectedIndexProperty, tabStripProperty } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-navigation-base';
3
+ import { TabsPosition } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-navigation/index-common';
3
4
  import { TabStrip } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-strip';
4
5
  import { TabStripItem } from '@nativescript-community/ui-material-core/tab-navigation-base/tab-strip-item';
5
- import { CSSType, Color, Device, Font, Frame, IOSHelper, ImageSource, Property, Utils, View, booleanConverter } from '@nativescript/core';
6
+ import { CSSType, Color, CoreTypes, Device, Font, Frame, IOSHelper, ImageSource, Property, Utils, View, booleanConverter } from '@nativescript/core';
6
7
  import { getTransformedText } from '@nativescript/core/ui/text-base';
7
8
  import { iOSNativeHelper } from '@nativescript/core/utils';
8
9
  export { TabContentItem, TabStrip, TabStripItem };
@@ -152,7 +153,7 @@ var UINavigationControllerDelegateImpl = /** @class */ (function (_super) {
152
153
  if (owner) {
153
154
  // If viewController is one of our tab item controllers, then "< More" will be visible shortly.
154
155
  // Otherwise viewController is the UIMoreListController which shows the list of all tabs beyond the 4th tab.
155
- var backToMoreWillBeVisible = owner._ios.viewControllers.containsObject(viewController);
156
+ var backToMoreWillBeVisible = owner.viewController.viewControllers.containsObject(viewController);
156
157
  owner._handleTwoNavigationBars(backToMoreWillBeVisible);
157
158
  }
158
159
  };
@@ -237,21 +238,24 @@ export const iosCustomPositioningProperty = new Property({
237
238
  let BottomNavigation = class BottomNavigation extends TabNavigationBase {
238
239
  constructor() {
239
240
  super();
240
- this._iconsCache = {};
241
- this.viewController = this._ios = UITabBarControllerImpl.initWithOwner(new WeakRef(this));
242
- this.nativeViewProtected = this._ios.view;
241
+ this.tabsPosition = TabsPosition.Bottom;
242
+ this.mIconsCache = {};
243
+ this.viewController = UITabBarControllerImpl.initWithOwner(new WeakRef(this));
244
+ }
245
+ createNativeView() {
246
+ return this.viewController.view;
243
247
  }
244
248
  initNativeView() {
245
249
  super.initNativeView();
246
- this._delegate = UITabBarControllerDelegateImpl.initWithOwner(new WeakRef(this));
247
- this._moreNavigationControllerDelegate = UINavigationControllerDelegateImpl.initWithOwner(new WeakRef(this));
250
+ this.mDelegate = UITabBarControllerDelegateImpl.initWithOwner(new WeakRef(this));
251
+ this.mMoreNavigationControllerDelegate = UINavigationControllerDelegateImpl.initWithOwner(new WeakRef(this));
248
252
  if (!this.tabStrip) {
249
253
  this.viewController.tabBar.hidden = true;
250
254
  }
251
255
  }
252
256
  disposeNativeView() {
253
- this._delegate = null;
254
- this._moreNavigationControllerDelegate = null;
257
+ this.mDelegate = null;
258
+ this.mMoreNavigationControllerDelegate = null;
255
259
  super.disposeNativeView();
256
260
  }
257
261
  onLoaded() {
@@ -262,19 +266,19 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
262
266
  if (selectedView instanceof Frame) {
263
267
  selectedView._pushInFrameStackRecursive();
264
268
  }
265
- this._ios.delegate = this._delegate;
269
+ this.viewController.delegate = this.mDelegate;
266
270
  this.onSelectedIndexChanged(selectedIndex, selectedIndex);
267
271
  }
268
272
  onUnloaded() {
269
- this._ios.delegate = null;
270
- this._ios.moreNavigationController.delegate = null;
273
+ this.viewController.delegate = null;
274
+ this.viewController.moreNavigationController.delegate = null;
271
275
  super.onUnloaded();
272
276
  this.items.forEach((item, i) => {
273
277
  item.unloadView(item.content);
274
278
  });
275
279
  }
276
280
  get ios() {
277
- return this._ios;
281
+ return this.viewController;
278
282
  }
279
283
  layoutNativeView(left, top, right, bottom) {
280
284
  if (this.iosCustomPositioning) {
@@ -319,10 +323,10 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
319
323
  super.onSelectedIndexChanged(oldIndex, newIndex);
320
324
  }
321
325
  getTabBarBackgroundColor() {
322
- return this._ios.tabBar.barTintColor;
326
+ return this.viewController.tabBar.barTintColor;
323
327
  }
324
328
  setTabBarBackgroundColor(value) {
325
- this._ios.tabBar.barTintColor = value instanceof Color ? value.ios : value;
329
+ this.viewController.tabBar.barTintColor = value instanceof Color ? value.ios : value;
326
330
  this.updateAllItemsColors();
327
331
  }
328
332
  setTabBarItemTitle(tabStripItem, value) {
@@ -338,16 +342,16 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
338
342
  this.setViewAttributes(tabStripItem.nativeView, tabStripItem.label);
339
343
  }
340
344
  setItemColors() {
341
- if (this._selectedItemColor) {
342
- this.viewController.tabBar.selectedImageTintColor = this._selectedItemColor.ios;
345
+ if (this.mSelectedItemColor) {
346
+ this.viewController.tabBar.selectedImageTintColor = this.mSelectedItemColor.ios;
343
347
  }
344
- if (this._unSelectedItemColor) {
345
- this.viewController.tabBar.unselectedItemTintColor = this._unSelectedItemColor.ios;
348
+ if (this.mUnSelectedItemColor) {
349
+ this.viewController.tabBar.unselectedItemTintColor = this.mUnSelectedItemColor.ios;
346
350
  }
347
351
  }
348
352
  setIconColor(tabStripItem, forceReload = false) {
349
- if (forceReload || (!this._unSelectedItemColor && !this._selectedItemColor)) {
350
- const tabStripColor = this.selectedIndex === tabStripItem._index ? this._selectedItemColor : this._unSelectedItemColor;
353
+ if (forceReload || (!this.mUnSelectedItemColor && !this.mSelectedItemColor)) {
354
+ const tabStripColor = this.selectedIndex === tabStripItem._index ? this.mSelectedItemColor : this.mUnSelectedItemColor;
351
355
  const image = this.getIcon(tabStripItem, tabStripColor);
352
356
  tabStripItem.nativeView.image = image;
353
357
  tabStripItem.nativeView.selectedImage = image;
@@ -366,23 +370,23 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
366
370
  tabStripItem.nativeView.title = getTransformedText(tabStripItem.label.text, value);
367
371
  }
368
372
  getTabBarHighlightColor() {
369
- return this._ios.tabBar.tintColor;
373
+ return this.viewController.tabBar.tintColor;
370
374
  }
371
375
  setTabBarHighlightColor(value) {
372
- this._ios.tabBar.tintColor = value instanceof Color ? value.ios : value;
376
+ this.viewController.tabBar.tintColor = value instanceof Color ? value.ios : value;
373
377
  }
374
378
  getTabBarSelectedItemColor() {
375
- return this._selectedItemColor;
379
+ return this.mSelectedItemColor;
376
380
  }
377
381
  setTabBarSelectedItemColor(value) {
378
- this._selectedItemColor = value;
382
+ this.mSelectedItemColor = value;
379
383
  this.updateAllItemsColors();
380
384
  }
381
385
  getTabBarUnSelectedItemColor() {
382
- return this._unSelectedItemColor;
386
+ return this.mUnSelectedItemColor;
383
387
  }
384
388
  setTabBarUnSelectedItemColor(value) {
385
- this._unSelectedItemColor = value;
389
+ this.mUnSelectedItemColor = value;
386
390
  this.updateAllItemsColors();
387
391
  }
388
392
  onMeasure(widthMeasureSpec, heightMeasureSpec) {
@@ -395,8 +399,8 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
395
399
  this.setMeasuredDimension(widthAndState, heightAndState);
396
400
  }
397
401
  _onViewControllerShown(viewController) {
398
- if (this._ios.viewControllers && this._ios.viewControllers.containsObject(viewController)) {
399
- this.selectedIndex = this._ios.viewControllers.indexOfObject(viewController);
402
+ if (this.viewController.viewControllers && this.viewController.viewControllers.containsObject(viewController)) {
403
+ this.selectedIndex = this.viewController.viewControllers.indexOfObject(viewController);
400
404
  }
401
405
  else {
402
406
  }
@@ -447,13 +451,13 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
447
451
  setViewControllers(items) {
448
452
  const length = items ? items.length : 0;
449
453
  if (length === 0) {
450
- this._ios.viewControllers = null;
454
+ this.viewController.viewControllers = null;
451
455
  return;
452
456
  }
453
457
  items = items.slice(0, maxTabsCount);
454
458
  const controllers = NSMutableArray.alloc().initWithCapacity(length);
455
459
  if (this.tabStrip) {
456
- this.tabStrip.setNativeView(this._ios.tabBar);
460
+ this.tabStrip.setNativeView(this.viewController.tabBar);
457
461
  }
458
462
  items.forEach((item, i) => {
459
463
  const controller = this.getViewController(item);
@@ -469,21 +473,21 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
469
473
  controllers.addObject(controller);
470
474
  });
471
475
  this.setItemImages();
472
- this._ios.viewControllers = controllers;
473
- this._ios.customizableViewControllers = null;
474
- this._ios.moreNavigationController.delegate = this._moreNavigationControllerDelegate;
476
+ this.viewController.viewControllers = controllers;
477
+ this.viewController.customizableViewControllers = null;
478
+ this.viewController.moreNavigationController.delegate = this.mMoreNavigationControllerDelegate;
475
479
  }
476
480
  setItemImages() {
477
- if (this._selectedItemColor || this._unSelectedItemColor) {
481
+ if (this.mSelectedItemColor || this.mUnSelectedItemColor) {
478
482
  if (this.tabStrip && this.tabStrip.items) {
479
483
  this.tabStrip.items.forEach((item) => {
480
- if (this._unSelectedItemColor && item.nativeView) {
481
- item.nativeView.image = this.getIcon(item, this._unSelectedItemColor);
482
- item.nativeView.tintColor = this._unSelectedItemColor;
484
+ if (this.mUnSelectedItemColor && item.nativeView) {
485
+ item.nativeView.image = this.getIcon(item, this.mUnSelectedItemColor);
486
+ item.nativeView.tintColor = this.mUnSelectedItemColor;
483
487
  }
484
- if (this._selectedItemColor && item.nativeView) {
485
- item.nativeView.selectedImage = this.getIcon(item, this._selectedItemColor);
486
- item.nativeView.tintColor = this._selectedItemColor;
488
+ if (this.mSelectedItemColor && item.nativeView) {
489
+ item.nativeView.selectedImage = this.getIcon(item, this.mSelectedItemColor);
490
+ item.nativeView.tintColor = this.mSelectedItemColor;
487
491
  }
488
492
  });
489
493
  }
@@ -537,7 +541,7 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
537
541
  }
538
542
  const iconTag = [iconSource, font.fontStyle, font.fontWeight, font.fontSize, font.fontFamily, color].join(';');
539
543
  let isFontIcon = false;
540
- let image = this._iconsCache[iconTag];
544
+ let image = this.mIconsCache[iconTag];
541
545
  if (!image) {
542
546
  let is;
543
547
  if (Utils.isFontIconURI(iconSource)) {
@@ -558,7 +562,7 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
558
562
  renderingMode = this.getIconRenderingMode();
559
563
  }
560
564
  const originalRenderedImage = image.imageWithRenderingMode(renderingMode);
561
- this._iconsCache[iconTag] = originalRenderedImage;
565
+ this.mIconsCache[iconTag] = originalRenderedImage;
562
566
  image = originalRenderedImage;
563
567
  }
564
568
  else {
@@ -583,8 +587,8 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
583
587
  }
584
588
  [selectedIndexProperty.setNative](value) {
585
589
  if (value > -1) {
586
- this._ios._willSelectViewController = this._ios.viewControllers[value];
587
- this._ios.selectedIndex = value;
590
+ this.viewController._willSelectViewController = this.viewController.viewControllers[value];
591
+ this.viewController.selectedIndex = value;
588
592
  }
589
593
  }
590
594
  [itemsProperty.getDefault]() {
@@ -616,15 +620,15 @@ let BottomNavigation = class BottomNavigation extends TabNavigationBase {
616
620
  const tabItemTextColor = view.style.color;
617
621
  const textColor = tabItemTextColor instanceof Color ? tabItemTextColor.ios : null;
618
622
  const attributes = { [NSFontAttributeName]: font };
619
- if (!this._selectedItemColor && !this._unSelectedItemColor) {
623
+ if (!this.mSelectedItemColor && !this.mUnSelectedItemColor) {
620
624
  if (textColor) {
621
625
  attributes[UITextAttributeTextColor] = textColor;
622
626
  attributes[NSForegroundColorAttributeName] = textColor;
623
627
  }
624
628
  }
625
629
  else {
626
- this.viewController.tabBar.unselectedItemTintColor = this._unSelectedItemColor && this._unSelectedItemColor.ios;
627
- this.viewController.tabBar.selectedImageTintColor = this._selectedItemColor && this._selectedItemColor.ios;
630
+ this.viewController.tabBar.unselectedItemTintColor = this.mUnSelectedItemColor && this.mUnSelectedItemColor.ios;
631
+ this.viewController.tabBar.selectedImageTintColor = this.mSelectedItemColor && this.mSelectedItemColor.ios;
628
632
  }
629
633
  item.setTitleTextAttributesForState(attributes, 4);
630
634
  item.setTitleTextAttributesForState(attributes, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-material-bottom-navigation",
3
- "version": "6.2.14",
3
+ "version": "6.2.17",
4
4
  "description": "Material Design Bottom Navigation bars allow movement between primary destinations in an app. Tapping on a bottom navigation icon takes you directly to the associated view or refreshes the currently active view.",
5
5
  "main": "bottomnavigation",
6
6
  "sideEffects": false,
@@ -12,9 +12,10 @@
12
12
  }
13
13
  },
14
14
  "scripts": {
15
- "tsc": "../../node_modules/.bin/cpy ../../src/bottom-navigation/index.d.ts ./ && ../../node_modules/.bin/tsc --skipLibCheck -d",
16
- "tsc-win": "..\\..\\node_modules\\.bin\\cpy ..\\..\\src\\bottom-navigation\\index.d.ts .\\ && ..\\..\\node_modules\\.bin\\tsc --skipLibCheck -d",
15
+ "tsc": "../../node_modules/.bin/cpy ../../src/bottom-navigation/index.d.ts ./ && ../../node_modules/.bin/tsc -d",
16
+ "tsc-win": "..\\..\\node_modules\\.bin\\cpy ..\\..\\src\\bottom-navigation\\index.d.ts .\\ && ..\\..\\node_modules\\.bin\\tsc -d",
17
17
  "build": "npm run tsc",
18
+ "build.watch": "npm run tsc -- -w",
18
19
  "build.win": "npm run tsc-win",
19
20
  "build.all": "npm run build && npm run build.angular",
20
21
  "build.all.win": "npm run build.win && npm run build.angular.win",
@@ -50,7 +51,7 @@
50
51
  },
51
52
  "readmeFilename": "README.md",
52
53
  "dependencies": {
53
- "@nativescript-community/ui-material-core": "^6.2.14"
54
+ "@nativescript-community/ui-material-core": "^6.2.17"
54
55
  },
55
- "gitHead": "750b56e352d255473933621e1466b3bd891f930d"
56
+ "gitHead": "c3cf2af896fcd0db9d89094415175b99a38ac129"
56
57
  }
package/pnpm-lock.yaml ADDED
@@ -0,0 +1,90 @@
1
+ dependencies:
2
+ '@nativescript-community/ui-material-core': 5.2.1
3
+ lockfileVersion: 5.2
4
+ packages:
5
+ /@nativescript-community/ui-material-core/5.2.1:
6
+ dependencies:
7
+ '@nativescript/hook': 2.0.0
8
+ dev: false
9
+ requiresBuild: true
10
+ resolution:
11
+ integrity: sha512-Nu0ujgzvpH4sN7Rebk3YsEcnbTR2uWXL+xy95gXflR42qa1YUVgMTXZJJm3sEcCEMKeneMODc8lpIrLOAf6mCg==
12
+ /@nativescript/hook/2.0.0:
13
+ dependencies:
14
+ glob: 7.1.6
15
+ mkdirp: 1.0.4
16
+ dev: false
17
+ resolution:
18
+ integrity: sha512-v3Hj3Zpd69sQJfFpDNXonV0EjO1a2OL4l48wlo1Ycsqk4r7RY822d/irFTjt0LllRG0OcdEGgfG6wKb0YgPyHw==
19
+ /balanced-match/1.0.0:
20
+ dev: false
21
+ resolution:
22
+ integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
23
+ /brace-expansion/1.1.11:
24
+ dependencies:
25
+ balanced-match: 1.0.0
26
+ concat-map: 0.0.1
27
+ dev: false
28
+ resolution:
29
+ integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
30
+ /concat-map/0.0.1:
31
+ dev: false
32
+ resolution:
33
+ integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
34
+ /fs.realpath/1.0.0:
35
+ dev: false
36
+ resolution:
37
+ integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
38
+ /glob/7.1.6:
39
+ dependencies:
40
+ fs.realpath: 1.0.0
41
+ inflight: 1.0.6
42
+ inherits: 2.0.4
43
+ minimatch: 3.0.4
44
+ once: 1.4.0
45
+ path-is-absolute: 1.0.1
46
+ dev: false
47
+ resolution:
48
+ integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
49
+ /inflight/1.0.6:
50
+ dependencies:
51
+ once: 1.4.0
52
+ wrappy: 1.0.2
53
+ dev: false
54
+ resolution:
55
+ integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
56
+ /inherits/2.0.4:
57
+ dev: false
58
+ resolution:
59
+ integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
60
+ /minimatch/3.0.4:
61
+ dependencies:
62
+ brace-expansion: 1.1.11
63
+ dev: false
64
+ resolution:
65
+ integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
66
+ /mkdirp/1.0.4:
67
+ dev: false
68
+ engines:
69
+ node: '>=10'
70
+ hasBin: true
71
+ resolution:
72
+ integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
73
+ /once/1.4.0:
74
+ dependencies:
75
+ wrappy: 1.0.2
76
+ dev: false
77
+ resolution:
78
+ integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
79
+ /path-is-absolute/1.0.1:
80
+ dev: false
81
+ engines:
82
+ node: '>=0.10.0'
83
+ resolution:
84
+ integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
85
+ /wrappy/1.0.2:
86
+ dev: false
87
+ resolution:
88
+ integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
89
+ specifiers:
90
+ '@nativescript-community/ui-material-core': ^5.2.1
package/react/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { registerElement } from 'react-nativescript';
1
+ import { NSVElement, registerElement } from 'react-nativescript';
2
2
  import { warn } from 'react-nativescript/dist/shared/Logger';
3
3
  import { BottomNavigation, TabContentItem, TabStrip } from '../';
4
4
  let installed = false;