mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
feat(ios): allow custom navigationBar and toolbar on frame (#10495)
This commit is contained in:
9
packages/core/ui/frame/index.d.ts
vendored
9
packages/core/ui/frame/index.d.ts
vendored
@ -134,6 +134,15 @@ export class Frame extends FrameBase {
|
|||||||
*/
|
*/
|
||||||
ios: iOSFrame;
|
ios: iOSFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify a custom UINavigationBar class (iOS only)
|
||||||
|
*/
|
||||||
|
iosNavigationBarClass: any;
|
||||||
|
/**
|
||||||
|
* Specify a custom UIToolbar class (iOS only)
|
||||||
|
*/
|
||||||
|
iosToolBarClass: any;
|
||||||
|
|
||||||
//@private
|
//@private
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
@ -28,6 +28,8 @@ export class Frame extends FrameBase {
|
|||||||
viewController: UINavigationControllerImpl;
|
viewController: UINavigationControllerImpl;
|
||||||
_animatedDelegate: UINavigationControllerDelegate;
|
_animatedDelegate: UINavigationControllerDelegate;
|
||||||
public _ios: iOSFrame;
|
public _ios: iOSFrame;
|
||||||
|
iosNavigationBarClass: typeof NSObject;
|
||||||
|
iosToolbarClass: typeof NSObject;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -467,7 +469,9 @@ class UINavigationControllerImpl extends UINavigationController {
|
|||||||
private _owner: WeakRef<Frame>;
|
private _owner: WeakRef<Frame>;
|
||||||
|
|
||||||
public static initWithOwner(owner: WeakRef<Frame>): UINavigationControllerImpl {
|
public static initWithOwner(owner: WeakRef<Frame>): UINavigationControllerImpl {
|
||||||
const controller = <UINavigationControllerImpl>UINavigationControllerImpl.new();
|
const navigationBarClass = owner.deref()?.iosNavigationBarClass ?? null;
|
||||||
|
const toolbarClass = owner.deref()?.iosToolbarClass ?? null;
|
||||||
|
const controller = navigationBarClass || toolbarClass ? <UINavigationControllerImpl>UINavigationControllerImpl.alloc().initWithNavigationBarClassToolbarClass(navigationBarClass, toolbarClass) : <UINavigationControllerImpl>UINavigationControllerImpl.new();
|
||||||
controller._owner = owner;
|
controller._owner = owner;
|
||||||
|
|
||||||
return controller;
|
return controller;
|
||||||
|
Reference in New Issue
Block a user