Merge pull request #1934 from NativeScript/raikov/side-drawer-fix

fixed: some transitions in side drawer are not working
This commit is contained in:
tzraikov
2016-04-13 14:25:25 +03:00
3 changed files with 49 additions and 2 deletions

View File

@ -579,4 +579,11 @@ declare module "application" {
*/ */
removeNotificationObserver(observer: any, notificationName: string): void; removeNotificationObserver(observer: any, notificationName: string): void;
} }
/* tslint:disable */
export interface RootViewControllerImpl {
contentController: any;
}
} }

View File

@ -13,6 +13,43 @@ class Responder extends UIResponder {
// //
} }
class RootViewControllerImpl extends UIViewController implements definition.RootViewControllerImpl {
private _contentController: UIViewController;
get contentController(): UIViewController {
return this._contentController;
}
set contentController(contentController: UIViewController) {
if (contentController.parentViewController !== null) {
contentController.willMoveToParentViewController(null);
contentController.view.removeFromSuperview();
contentController.removeFromParentViewController();
contentController.didMoveToParentViewController(this);
}
if (this._contentController) {
this._contentController.willMoveToParentViewController(null);
this._contentController.view.removeFromSuperview();
this._contentController.removeFromParentViewController();
}
this.addChildViewController(contentController);
this.view.addSubview(contentController.view);
contentController.view.frame = this.view.bounds;
contentController.view.autoresizingMask = UIViewAutoresizing.UIViewAutoresizingFlexibleWidth | UIViewAutoresizing.UIViewAutoresizingFlexibleHeight;
this._contentController = contentController;
this._contentController.didMoveToParentViewController(this);
}
public viewDidLoad(): void {
super.viewDidLoad();
this.view.backgroundColor = UIColor.whiteColor();
}
}
class Window extends UIWindow { class Window extends UIWindow {
private _content; private _content;
@ -144,7 +181,9 @@ class IOSApplication implements definition.iOSApplication {
this._window.content = rootView; this._window.content = rootView;
if (rootView instanceof Frame) { if (rootView instanceof Frame) {
this.rootController = this._window.rootViewController = rootView.ios.controller; let rootController = new RootViewControllerImpl();
this.rootController = this._window.rootViewController = rootController;
rootController.contentController = rootView.ios.controller;
} }
else if (rootView.ios instanceof UIViewController) { else if (rootView.ios instanceof UIViewController) {
this.rootController = this._window.rootViewController = rootView.ios; this.rootController = this._window.rootViewController = rootView.ios;

View File

@ -430,6 +430,7 @@ class UINavigationControllerImpl extends UINavigationController {
} }
public viewDidLoad(): void { public viewDidLoad(): void {
super.viewDidLoad();
let owner = this._owner.get(); let owner = this._owner.get();
if (owner) { if (owner) {
owner.onLoaded(); owner.onLoaded();