mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(ios): Objective-C class name "UITabBar..." already in use handling
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
"main": "index",
|
||||
"types": "index.d.ts",
|
||||
"description": "NativeScript Core Modules",
|
||||
"version": "6.5.17",
|
||||
"version": "6.5.18",
|
||||
"homepage": "https://www.nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -18,12 +18,18 @@ export * from "./tab-view-common";
|
||||
const majorVersion = iosUtils.MajorVersion;
|
||||
const isPhone = device.deviceType === "Phone";
|
||||
|
||||
class UITabBarControllerImpl extends UITabBarController {
|
||||
let UITabBarControllerImpl;
|
||||
let UITabBarControllerDelegateImpl;
|
||||
let UINavigationControllerDelegateImpl;
|
||||
|
||||
const setupControllers = function () {
|
||||
if (typeof UITabBarControllerImpl === 'undefined') {
|
||||
class UITabBarControllerClass extends UITabBarController {
|
||||
|
||||
private _owner: WeakRef<TabView>;
|
||||
|
||||
public static initWithOwner(owner: WeakRef<TabView>): UITabBarControllerImpl {
|
||||
let handler = <UITabBarControllerImpl>UITabBarControllerImpl.new();
|
||||
public static initWithOwner(owner: WeakRef<TabView>): typeof UITabBarControllerImpl {
|
||||
let handler = <typeof UITabBarControllerImpl>UITabBarControllerImpl.new();
|
||||
handler._owner = owner;
|
||||
|
||||
return handler;
|
||||
@ -85,14 +91,15 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
}
|
||||
}
|
||||
}
|
||||
UITabBarControllerImpl = UITabBarControllerClass;
|
||||
|
||||
class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate {
|
||||
class UITabBarControllerDelegateClass extends NSObject implements UITabBarControllerDelegate {
|
||||
public static ObjCProtocols = [UITabBarControllerDelegate];
|
||||
|
||||
private _owner: WeakRef<TabView>;
|
||||
|
||||
public static initWithOwner(owner: WeakRef<TabView>): UITabBarControllerDelegateImpl {
|
||||
let delegate = <UITabBarControllerDelegateImpl>UITabBarControllerDelegateImpl.new();
|
||||
public static initWithOwner(owner: WeakRef<TabView>): typeof UITabBarControllerDelegateImpl {
|
||||
let delegate = <typeof UITabBarControllerDelegateImpl>UITabBarControllerDelegateImpl.new();
|
||||
delegate._owner = owner;
|
||||
|
||||
return delegate;
|
||||
@ -132,14 +139,15 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
|
||||
(<any>tabBarController)._willSelectViewController = undefined;
|
||||
}
|
||||
}
|
||||
UITabBarControllerDelegateImpl = UITabBarControllerDelegateClass;
|
||||
|
||||
class UINavigationControllerDelegateImpl extends NSObject implements UINavigationControllerDelegate {
|
||||
class UINavigationControllerDelegateClass extends NSObject implements UINavigationControllerDelegate {
|
||||
public static ObjCProtocols = [UINavigationControllerDelegate];
|
||||
|
||||
private _owner: WeakRef<TabView>;
|
||||
|
||||
public static initWithOwner(owner: WeakRef<TabView>): UINavigationControllerDelegateImpl {
|
||||
let delegate = <UINavigationControllerDelegateImpl>UINavigationControllerDelegateImpl.new();
|
||||
public static initWithOwner(owner: WeakRef<TabView>): typeof UINavigationControllerDelegateImpl {
|
||||
let delegate = <typeof UINavigationControllerDelegateImpl>UINavigationControllerDelegateImpl.new();
|
||||
delegate._owner = owner;
|
||||
|
||||
return delegate;
|
||||
@ -171,6 +179,12 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
|
||||
}
|
||||
}
|
||||
}
|
||||
UINavigationControllerDelegateImpl = UINavigationControllerDelegateClass;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
setupControllers();
|
||||
|
||||
function updateTitleAndIconPositions(tabItem: TabViewItem, tabBarItem: UITabBarItem, controller: UIViewController) {
|
||||
if (!tabItem || !tabBarItem) {
|
||||
@ -256,11 +270,11 @@ export class TabViewItem extends TabViewItemBase {
|
||||
}
|
||||
|
||||
export class TabView extends TabViewBase {
|
||||
public viewController: UITabBarControllerImpl;
|
||||
public viewController: typeof UITabBarControllerImpl;
|
||||
public items: TabViewItem[];
|
||||
public _ios: UITabBarControllerImpl;
|
||||
private _delegate: UITabBarControllerDelegateImpl;
|
||||
private _moreNavigationControllerDelegate: UINavigationControllerDelegateImpl;
|
||||
public _ios: typeof UITabBarControllerImpl;
|
||||
private _delegate: typeof UITabBarControllerDelegateImpl;
|
||||
private _moreNavigationControllerDelegate: typeof UINavigationControllerDelegateImpl;
|
||||
private _iconsCache = {};
|
||||
|
||||
constructor() {
|
||||
|
@ -3,7 +3,7 @@
|
||||
"main": "index",
|
||||
"types": "index.d.ts",
|
||||
"description": "NativeScript Core Modules",
|
||||
"version": "6.5.17",
|
||||
"version": "6.5.18",
|
||||
"homepage": "https://www.nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -11,7 +11,7 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@nativescript/core": "6.5.17"
|
||||
"@nativescript/core": "6.5.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tns-platform-declarations": "6.5.15"
|
||||
|
Reference in New Issue
Block a user