@nativescript-community/ui-bottom-navigation 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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +201 -0
- package/README.md +230 -2
- package/bottom-accessory.android.d.ts +7 -0
- package/bottom-accessory.android.js +11 -0
- package/bottom-accessory.android.js.map +1 -0
- package/bottom-accessory.d.ts +9 -0
- package/bottom-accessory.ios.d.ts +14 -0
- package/bottom-accessory.ios.js +32 -0
- package/bottom-accessory.ios.js.map +1 -0
- package/index.android.d.ts +34 -0
- package/index.android.js +143 -0
- package/index.android.js.map +1 -0
- package/index.d.ts +114 -0
- package/index.ios.d.ts +137 -0
- package/index.ios.js +1022 -0
- package/index.ios.js.map +1 -0
- package/package.json +50 -5
- package/platforms/android/native-api-usage.json +9 -0
- package/platforms/ios/native-api-usage.json +11 -0
- package/search-content.d.ts +4 -0
- package/search-content.js +9 -0
- package/search-content.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -0
package/index.android.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { BottomAccessory } from './bottom-accessory';
|
|
2
|
+
import { TabContentItem } from '@nativescript-community/ui-core-tabs/tab-content-item';
|
|
3
|
+
import { TabNavigation } from '@nativescript-community/ui-core-tabs/tab-navigation/index.android';
|
|
4
|
+
import { TabStrip } from '@nativescript-community/ui-core-tabs/tab-strip';
|
|
5
|
+
import { TabStripItem } from '@nativescript-community/ui-core-tabs/tab-strip-item';
|
|
6
|
+
import { TabsPosition } from '@nativescript-community/ui-core-tabs/tab-navigation/index-common';
|
|
7
|
+
import { CSSType } from '@nativescript/core';
|
|
8
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
|
9
|
+
// eslint-disable-next-line no-redeclare
|
|
10
|
+
let BottomNavigationBar;
|
|
11
|
+
function initializeNativeClasses() {
|
|
12
|
+
if (BottomNavigationBar) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
var NavigationBarImplementation = /** @class */ (function (_super) {
|
|
16
|
+
__extends(NavigationBarImplementation, _super);
|
|
17
|
+
function NavigationBarImplementation(context, owner) {
|
|
18
|
+
var _this = _super.call(this, context) || this;
|
|
19
|
+
_this.owner = owner;
|
|
20
|
+
return global.__native(_this);
|
|
21
|
+
}
|
|
22
|
+
NavigationBarImplementation.prototype.onSelectedPositionChange = function (position, prevPosition) {
|
|
23
|
+
var owner = this.owner;
|
|
24
|
+
if (!owner) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
owner.onTabsBarSelectedPositionChange(position, prevPosition);
|
|
28
|
+
};
|
|
29
|
+
NavigationBarImplementation.prototype.onTap = function (position) {
|
|
30
|
+
var owner = this.owner;
|
|
31
|
+
if (!owner) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return owner.onTabsBarTap(position);
|
|
35
|
+
};
|
|
36
|
+
return NavigationBarImplementation;
|
|
37
|
+
}(com.nativescript.ui.core.NavigationBar));
|
|
38
|
+
BottomNavigationBar = NavigationBarImplementation;
|
|
39
|
+
}
|
|
40
|
+
let BottomNavigation = class BottomNavigation extends TabNavigation {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.tabsPosition = TabsPosition.Bottom;
|
|
44
|
+
this.animationEnabled = false;
|
|
45
|
+
this.swipeEnabled = false;
|
|
46
|
+
}
|
|
47
|
+
updateTabsBarItemAt(position, itemSpec) {
|
|
48
|
+
this.mTabsBar.updateItemAt(position, itemSpec);
|
|
49
|
+
}
|
|
50
|
+
setTabsBarSelectedIndicatorColors(colors) {
|
|
51
|
+
// nothing to do
|
|
52
|
+
}
|
|
53
|
+
getTabBarItemView(index) {
|
|
54
|
+
return this.mTabsBar.getViewForItemAt(index);
|
|
55
|
+
}
|
|
56
|
+
getTabBarItemTextView(index) {
|
|
57
|
+
// the labels are styled by the Material navigation bar (theme), binding them to the TabStripItem would apply the NativeScript styles
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
createNativeTabBar(context) {
|
|
61
|
+
initializeNativeClasses();
|
|
62
|
+
// Material 3 navigation bar: the colors come from the theme
|
|
63
|
+
const tabsBar = new BottomNavigationBar(context, this);
|
|
64
|
+
tabsBar.setSelectedPosition(this.selectedIndex);
|
|
65
|
+
return tabsBar;
|
|
66
|
+
}
|
|
67
|
+
setTabBarItems(tabItems) {
|
|
68
|
+
this.mTabsBar.setItems(tabItems);
|
|
69
|
+
this._setItemsColors(null);
|
|
70
|
+
}
|
|
71
|
+
_setItemColor(item) {
|
|
72
|
+
// the Material bar colors icons and labels with a state list, see _setItemsColors
|
|
73
|
+
}
|
|
74
|
+
selectTabBar(oldIndex, newIndex) {
|
|
75
|
+
this.mTabsBar.setSelectedPosition(newIndex);
|
|
76
|
+
}
|
|
77
|
+
onLoaded() {
|
|
78
|
+
super.onLoaded();
|
|
79
|
+
if (!this.tabStrip && this.mTabsBar) {
|
|
80
|
+
// manually set the visibility, so that the grid layout remeasures
|
|
81
|
+
this.mTabsBar.setVisibility(android.view.View.GONE);
|
|
82
|
+
}
|
|
83
|
+
// if (this._attachedToWindow) {
|
|
84
|
+
// this.changeTab(this.selectedIndex);
|
|
85
|
+
// }
|
|
86
|
+
}
|
|
87
|
+
// _onAttachedToWindow(): void {
|
|
88
|
+
// super._onAttachedToWindow();
|
|
89
|
+
// // this.changeTab(this.selectedIndex);
|
|
90
|
+
// }
|
|
91
|
+
updateAndroidItemAt(index, spec) {
|
|
92
|
+
// that try catch is fix for an android NPE error on css change which navigated in (not the current fragment)
|
|
93
|
+
try {
|
|
94
|
+
if (this.mTabsBar) {
|
|
95
|
+
this.mTabsBar.updateItemAt(index, spec);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) { }
|
|
99
|
+
}
|
|
100
|
+
setTabBarBackgroundColor(value) {
|
|
101
|
+
super.setTabBarBackgroundColor(value);
|
|
102
|
+
// this.updateTabStripItems();
|
|
103
|
+
}
|
|
104
|
+
// private updateTabStripItems(): void {
|
|
105
|
+
// this.tabStrip.items.forEach((tabStripItem: TabStripItem) => {
|
|
106
|
+
// if (tabStripItem.nativeView) {
|
|
107
|
+
// const tabItemSpec = this.createTabItemSpec(tabStripItem);
|
|
108
|
+
// this.updateAndroidItemAt(tabStripItem._index, tabItemSpec);
|
|
109
|
+
// }
|
|
110
|
+
// });
|
|
111
|
+
// }
|
|
112
|
+
_setItemsColors(items) {
|
|
113
|
+
// the Material bar colors icons and labels with a state list
|
|
114
|
+
this.mTabsBar?.setItemColors(this.mSelectedItemColor?.android || 0, this.mUnSelectedItemColor?.android || 0);
|
|
115
|
+
}
|
|
116
|
+
setTabBarSelectedItemColor(value) {
|
|
117
|
+
super.setTabBarSelectedItemColor(value);
|
|
118
|
+
this._setItemsColors(this.tabStrip.items);
|
|
119
|
+
}
|
|
120
|
+
setTabBarUnSelectedItemColor(value) {
|
|
121
|
+
super.setTabBarUnSelectedItemColor(value);
|
|
122
|
+
this._setItemsColors(this.tabStrip.items);
|
|
123
|
+
}
|
|
124
|
+
onTabsBarSelectedPositionChange(position, prevPosition) {
|
|
125
|
+
this.mViewPager.setCurrentItem(position, this.animationEnabled);
|
|
126
|
+
const tabStripItems = this.tabStrip && this.tabStrip.items;
|
|
127
|
+
if (position >= 0 && tabStripItems && tabStripItems[position]) {
|
|
128
|
+
tabStripItems[position]._emit(TabStripItem.selectEvent);
|
|
129
|
+
}
|
|
130
|
+
if (prevPosition >= 0 && tabStripItems && tabStripItems[prevPosition]) {
|
|
131
|
+
tabStripItems[prevPosition]._emit(TabStripItem.unselectEvent);
|
|
132
|
+
}
|
|
133
|
+
this._setItemsColors(this.tabStrip.items);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
BottomNavigation = __decorate([
|
|
137
|
+
CSSType('BottomNavigation')
|
|
138
|
+
], BottomNavigation);
|
|
139
|
+
export { BottomNavigation };
|
|
140
|
+
// iOS 26 only: the minimize behavior and the accessory of the tab bar are ignored on Android
|
|
141
|
+
import { BottomSearchContent } from './search-content';
|
|
142
|
+
export { BottomAccessory, BottomSearchContent };
|
|
143
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/ui-bottom-navigation/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mEAAmE,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAkD,MAAM,kEAAkE,CAAC;AAChJ,OAAO,EAAE,OAAO,EAAgB,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAMlD,wCAAwC;AACxC,IAAI,mBAAwC,CAAC;AAE7C,SAAS,uBAAuB;IAC5B,IAAI,mBAAmB,EAAE,CAAC;QACtB,OAAO;IACX,CAAC;;;;;;;;;;;;;;;;;;;;;;;;IA2BD,mBAAmB,GAAG,2BAAkC,CAAC;AAC7D,CAAC;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,aAAqD;IAApF;;QACH,iBAAY,GAAG,YAAY,CAAC,MAAM,CAAC;QACnC,qBAAgB,GAAG,KAAK,CAAC;QACzB,iBAAY,GAAG,KAAK,CAAC;IAyGzB,CAAC;IAxGsB,mBAAmB,CAAC,QAAgB,EAAE,QAA8C;QACnG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IACkB,iCAAiC,CAAC,MAAgB;QACjE,gBAAgB;IACpB,CAAC;IACkB,iBAAiB,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AY,CAAC,WAAW,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,YAAY,IAAI,CAAC,IAAI,aAAa,IAAI,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;YACpE,aAAa,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;CACJ,CAAA;AA5GY,gBAAgB;IAD5B,OAAO,CAAC,kBAAkB,CAAC;GACf,gBAAgB,CA4G5B;;AAED,6FAA6F;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material BottomNavigation component
|
|
3
|
+
* @module @nativescript-community/ui-bottom-navigation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BottomAccessory } from './bottom-accessory';
|
|
7
|
+
import { TabContentItem } from '@nativescript-community/ui-core-tabs/tab-content-item';
|
|
8
|
+
import { TabNavigationBase } from '@nativescript-community/ui-core-tabs/tab-navigation-base';
|
|
9
|
+
import { TabStrip } from '@nativescript-community/ui-core-tabs/tab-strip';
|
|
10
|
+
import { CoercibleProperty, EventData, Property, View } from '@nativescript/core';
|
|
11
|
+
import { TabStripItem } from '@nativescript-community/ui-core-tabs/tab-strip-item';
|
|
12
|
+
|
|
13
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
|
14
|
+
export { BottomAccessory } from './bottom-accessory';
|
|
15
|
+
export { BottomSearchContent } from './search-content';
|
|
16
|
+
|
|
17
|
+
/** iOS 26: how the tab bar minimizes when the content is scrolled */
|
|
18
|
+
export type MinimizeBehavior = 'automatic' | 'never' | 'onScrollDown' | 'onScrollUp';
|
|
19
|
+
/**
|
|
20
|
+
* Defines the data for the TabView.selectedIndexChanged event.
|
|
21
|
+
*/
|
|
22
|
+
export interface SelectedIndexChangedEventData extends EventData {
|
|
23
|
+
/**
|
|
24
|
+
* The old selected index.
|
|
25
|
+
*/
|
|
26
|
+
oldIndex: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The new selected index.
|
|
30
|
+
*/
|
|
31
|
+
newIndex: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents a tab navigation widget with static tabs at the bottom.
|
|
36
|
+
*/
|
|
37
|
+
export class BottomNavigation extends TabNavigationBase {
|
|
38
|
+
/**
|
|
39
|
+
* Gets or sets the items of the BottomNavigation.
|
|
40
|
+
*/
|
|
41
|
+
items: TabContentItem[];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* iOS 26: how the tab bar minimizes when the content is scrolled (the content must scroll). Ignored on Android.
|
|
45
|
+
*/
|
|
46
|
+
minimizeBehavior: MinimizeBehavior;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* iOS 26: a view above the tab bar, inline with it when the bar is minimized. Ignored on Android and on older iOS versions.
|
|
50
|
+
*/
|
|
51
|
+
accessory: BottomAccessory;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* iOS 18+: a search tab at the end of the tab bar, with the search field integrated in the bar (a separate glass button on iOS 26).
|
|
55
|
+
* It shows `searchContent`. Events: `search` (the text changed, `event.text`) and `searchSubmit`. Ignored on Android.
|
|
56
|
+
*/
|
|
57
|
+
searchTab: boolean;
|
|
58
|
+
/** placeholder of the search field */
|
|
59
|
+
searchHint: string;
|
|
60
|
+
/** the view shown by the search tab: the results */
|
|
61
|
+
searchContent: View;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Gets or sets the tab strip of the BottomNavigation.
|
|
65
|
+
*/
|
|
66
|
+
tabStrip: TabStrip;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets or sets the selectedIndex of the BottomNavigation.
|
|
70
|
+
*/
|
|
71
|
+
selectedIndex: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Allow custom positioning of Tabs within another view
|
|
75
|
+
*/
|
|
76
|
+
public iosCustomPositioning?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Gets the native [android widget](http://developer.android.com/reference/android/support/v4/view/ViewPager.html) that represents the user interface for this component. Valid only when running on Android OS.
|
|
80
|
+
*/
|
|
81
|
+
android: any /* android.view.View */; //android.support.v4.view.ViewPager;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Gets the native iOS [UITabBarController](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/) that represents the user interface for this component. Valid only when running on iOS.
|
|
85
|
+
*/
|
|
86
|
+
ios: any /* UITabBarController */;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* String value used when hooking to the selectedIndexChanged event.
|
|
90
|
+
*/
|
|
91
|
+
public static selectedIndexChangedEvent: string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @hidden
|
|
95
|
+
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
|
96
|
+
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
|
97
|
+
* @param callback - Callback function which will be executed when event is raised.
|
|
98
|
+
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
|
99
|
+
*/
|
|
100
|
+
on(eventNames: string, callback: (data: EventData) => void, thisArg?: any);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Raised when the selected index changes.
|
|
104
|
+
*/
|
|
105
|
+
on(event: 'selectedIndexChanged', callback: (args: SelectedIndexChangedEventData) => void, thisArg?: any);
|
|
106
|
+
|
|
107
|
+
// parameter to allow the bottom-navigation to be positioned correcly within layouts and thus not be full size
|
|
108
|
+
// be careful it will then be influenced by safeArea. Default is false
|
|
109
|
+
iosCustomPositioning: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const itemsProperty: Property<BottomNavigation, TabContentItem[]>;
|
|
113
|
+
export const tabStripProperty: Property<BottomNavigation, TabStrip>;
|
|
114
|
+
export const selectedIndexProperty: CoercibleProperty<BottomNavigation, number>;
|
package/index.ios.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BottomAccessory } from './bottom-accessory';
|
|
2
|
+
import { BottomSearchContent } from './search-content';
|
|
3
|
+
import { TabContentItem } from '@nativescript-community/ui-core-tabs/tab-content-item';
|
|
4
|
+
import { TabNavigationBase, itemsProperty, selectedIndexProperty, tabStripProperty } from '@nativescript-community/ui-core-tabs/tab-navigation-base';
|
|
5
|
+
import { TabsPosition } from '@nativescript-community/ui-core-tabs/tab-navigation/index-common';
|
|
6
|
+
import { TabStrip } from '@nativescript-community/ui-core-tabs/tab-strip';
|
|
7
|
+
import { TabStripItem } from '@nativescript-community/ui-core-tabs/tab-strip-item';
|
|
8
|
+
import { Color, CoreTypes, Font, Property, View, ViewBase } from '@nativescript/core';
|
|
9
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
|
10
|
+
declare class MDTabBarControllerImpl extends UITabBarController {
|
|
11
|
+
private _owner;
|
|
12
|
+
private _preventTraitCollectionChanges;
|
|
13
|
+
static initWithOwner(owner: WeakRef<BottomNavigation>): MDTabBarControllerImpl;
|
|
14
|
+
viewDidLoad(): void;
|
|
15
|
+
viewWillAppear(animated: boolean): void;
|
|
16
|
+
viewDidDisappear(animated: boolean): void;
|
|
17
|
+
viewWillTransitionToSizeWithTransitionCoordinator(size: CGSize, coordinator: UIViewControllerTransitionCoordinator): void;
|
|
18
|
+
traitCollectionDidChange(previousTraitCollection: UITraitCollection): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const iosCustomPositioningProperty: Property<BottomNavigation, boolean>;
|
|
21
|
+
export { BottomAccessory, BottomSearchContent };
|
|
22
|
+
/**
|
|
23
|
+
* iOS 26: how the tab bar minimizes when the content is scrolled. `automatic` is the system choice.
|
|
24
|
+
*/
|
|
25
|
+
export type MinimizeBehavior = 'automatic' | 'never' | 'onScrollDown' | 'onScrollUp';
|
|
26
|
+
export declare const minimizeBehaviorProperty: Property<BottomNavigation, MinimizeBehavior>;
|
|
27
|
+
export declare const searchTabProperty: Property<BottomNavigation, boolean>;
|
|
28
|
+
export declare const searchHintProperty: Property<BottomNavigation, string>;
|
|
29
|
+
export declare const searchContentProperty: Property<BottomNavigation, View>;
|
|
30
|
+
export declare const accessoryProperty: Property<BottomNavigation, BottomAccessory>;
|
|
31
|
+
export declare class BottomNavigation extends TabNavigationBase {
|
|
32
|
+
[searchTabProperty.setNative]: (value: boolean) => void;
|
|
33
|
+
[searchHintProperty.setNative]: (value: string) => void;
|
|
34
|
+
[minimizeBehaviorProperty.setNative]: (value: MinimizeBehavior) => void;
|
|
35
|
+
[selectedIndexProperty.setNative]: (value: number) => void;
|
|
36
|
+
[itemsProperty.getDefault]: () => TabContentItem[];
|
|
37
|
+
[itemsProperty.setNative]: (value: TabContentItem[]) => void;
|
|
38
|
+
[tabStripProperty.getDefault]: () => TabStrip;
|
|
39
|
+
[tabStripProperty.setNative]: (value: TabStrip) => void;
|
|
40
|
+
/** iOS 26: how the tab bar minimizes on scroll (the content must scroll: a ScrollView, a ListView, a CollectionView...) */
|
|
41
|
+
minimizeBehavior: MinimizeBehavior;
|
|
42
|
+
/** iOS 26: a view above the tab bar, inline with it when the bar is minimized. Ignored on older iOS versions */
|
|
43
|
+
accessory: BottomAccessory;
|
|
44
|
+
/**
|
|
45
|
+
* iOS 18+: adds a search tab at the end of the tab bar: the search field is integrated in the bar (a separate glass button on iOS 26)
|
|
46
|
+
* and the tab shows `searchContent` (the results). Events: `search` (text changed) and `searchSubmit`.
|
|
47
|
+
*/
|
|
48
|
+
searchTab: boolean;
|
|
49
|
+
/** placeholder of the search field */
|
|
50
|
+
searchHint: string;
|
|
51
|
+
/** the view shown by the search tab: the results of the search */
|
|
52
|
+
searchContent: View;
|
|
53
|
+
private mSearchHandler;
|
|
54
|
+
private mSearchController;
|
|
55
|
+
private mSearchTab;
|
|
56
|
+
private mSearchViewController;
|
|
57
|
+
/** the controllers of the items: `viewControllers` is null when the tab bar uses `tabs` (search tab) */
|
|
58
|
+
mItemControllers: UIViewController[];
|
|
59
|
+
/** the UITab of each item controller: a controller can not be in two UITab */
|
|
60
|
+
private mItemTabs;
|
|
61
|
+
tabsPosition: TabsPosition;
|
|
62
|
+
viewController: MDTabBarControllerImpl;
|
|
63
|
+
items: TabContentItem[];
|
|
64
|
+
private mDelegate;
|
|
65
|
+
private mMoreNavigationControllerDelegate;
|
|
66
|
+
private mIconsCache;
|
|
67
|
+
private mSelectedItemColor;
|
|
68
|
+
private mUnSelectedItemColor;
|
|
69
|
+
iosCustomPositioning: boolean;
|
|
70
|
+
constructor();
|
|
71
|
+
createNativeView(): UIView;
|
|
72
|
+
initNativeView(): void;
|
|
73
|
+
disposeNativeView(): void;
|
|
74
|
+
onLoaded(): void;
|
|
75
|
+
_addChildFromBuilder(name: string, value: any): void;
|
|
76
|
+
eachChild(callback: (child: ViewBase) => boolean): void;
|
|
77
|
+
eachChildView(callback: (child: View) => boolean): void;
|
|
78
|
+
_addViewToNativeVisualTree(child: ViewBase, atIndex?: number): boolean;
|
|
79
|
+
_removeViewFromNativeVisualTree(child: ViewBase): void;
|
|
80
|
+
_onSearchText(text: string): void;
|
|
81
|
+
_onSearchSubmit(text: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* iOS 18+: the UISearchTab at the end of the tab bar. The regular tabs stay view controllers, the search tab is added with the `tabs` API.
|
|
84
|
+
*/
|
|
85
|
+
private stripItemsLoaded;
|
|
86
|
+
updateSearchTab(): void;
|
|
87
|
+
/**
|
|
88
|
+
* `viewControllers` and `tabs` are exclusive: with a search tab every tab is a UITab wrapping the controller of the item
|
|
89
|
+
*/
|
|
90
|
+
private getRegularTabs;
|
|
91
|
+
private updateSearchController;
|
|
92
|
+
/**
|
|
93
|
+
* iOS 26: the UITabAccessory of the tab bar controller
|
|
94
|
+
*/
|
|
95
|
+
updateAccessory(): void;
|
|
96
|
+
onUnloaded(): void;
|
|
97
|
+
get ios(): UITabBarController;
|
|
98
|
+
layoutNativeView(left: number, top: number, right: number, bottom: number): void;
|
|
99
|
+
_setNativeViewFrame(nativeView: UIView, frame: CGRect): void;
|
|
100
|
+
onSelectedIndexChanged(oldIndex: number, newIndex: number): void;
|
|
101
|
+
getTabBarBackgroundColor(): UIColor;
|
|
102
|
+
setTabBarBackgroundColor(value: UIColor | Color): void;
|
|
103
|
+
setTabBarItemTitle(tabStripItem: TabStripItem, value: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* With a search tab, every tab is a UITab: they follow the title, the icons and the badge of the bar items
|
|
106
|
+
*/
|
|
107
|
+
syncSearchTabs(): void;
|
|
108
|
+
setTabBarItemBackgroundColor(tabStripItem: TabStripItem, value: UIColor | Color): void;
|
|
109
|
+
setTabBarItemColor(tabStripItem: TabStripItem, value: UIColor | Color): void;
|
|
110
|
+
private setItemColors;
|
|
111
|
+
private setIconColor;
|
|
112
|
+
private setPreTintedIcons;
|
|
113
|
+
setTabBarIconColor(tabStripItem: TabStripItem, value: UIColor | Color): void;
|
|
114
|
+
setTabBarIconSource(tabStripItem: TabStripItem, value: UIColor | Color): void;
|
|
115
|
+
setTabBarItemFontInternal(tabStripItem: TabStripItem, value: Font): void;
|
|
116
|
+
setTabBarItemTextTransform(tabStripItem: TabStripItem, value: CoreTypes.TextTransformType): void;
|
|
117
|
+
getTabBarHighlightColor(): UIColor;
|
|
118
|
+
setTabBarHighlightColor(value: UIColor | Color): void;
|
|
119
|
+
getTabBarSelectedItemColor(): Color;
|
|
120
|
+
setTabBarSelectedItemColor(value: Color): void;
|
|
121
|
+
getTabBarUnSelectedItemColor(): Color;
|
|
122
|
+
setTabBarUnSelectedItemColor(value: Color): void;
|
|
123
|
+
onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
|
124
|
+
_onViewControllerShown(viewController: UIViewController): void;
|
|
125
|
+
private _actionBarHiddenByTabView;
|
|
126
|
+
_handleTwoNavigationBars(backToMoreWillBeVisible: boolean): void;
|
|
127
|
+
private getViewController;
|
|
128
|
+
private setViewControllers;
|
|
129
|
+
private setItemImages;
|
|
130
|
+
updateAllItemsColors(): void;
|
|
131
|
+
private updateItemColors;
|
|
132
|
+
private createTabBarItem;
|
|
133
|
+
private getIconRenderingMode;
|
|
134
|
+
private getIcon;
|
|
135
|
+
private getFixedSizeIcon;
|
|
136
|
+
private setViewAttributes;
|
|
137
|
+
}
|