feat(ios): allow custom navigationBar and toolbar on frame (#10495)

This commit is contained in:
Eduardo Speroni
2024-04-02 16:29:09 -03:00
committed by GitHub
parent db0a852f5b
commit d67d297e37
2 changed files with 14 additions and 1 deletions

View File

@ -134,6 +134,15 @@ export class Frame extends FrameBase {
*/
ios: iOSFrame;
/**
* Specify a custom UINavigationBar class (iOS only)
*/
iosNavigationBarClass: any;
/**
* Specify a custom UIToolbar class (iOS only)
*/
iosToolBarClass: any;
//@private
/**
* @private

View File

@ -28,6 +28,8 @@ export class Frame extends FrameBase {
viewController: UINavigationControllerImpl;
_animatedDelegate: UINavigationControllerDelegate;
public _ios: iOSFrame;
iosNavigationBarClass: typeof NSObject;
iosToolbarClass: typeof NSObject;
constructor() {
super();
@ -467,7 +469,9 @@ class UINavigationControllerImpl extends UINavigationController {
private _owner: WeakRef<Frame>;
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;
return controller;