UNPKG

32.3 kBJavaScriptView Raw
1import { FrameBase, NavigationType } from './frame-common';
2import { Page } from '../page';
3import { View } from '../core/view';
4import { IOSHelper } from '../core/view/view-helper';
5import { profile } from '../../profiling';
6import { CORE_ANIMATION_DEFAULTS, ios as iOSUtils, layout } from '../../utils';
7import { Trace } from '../../trace';
8import { SlideTransition } from '../transition/slide-transition';
9import { FadeTransition } from '../transition/fade-transition';
10import { SharedTransition } from '../transition/shared-transition';
11export * from './frame-common';
12const majorVersion = iOSUtils.MajorVersion;
13const ENTRY = '_entry';
14const DELEGATE = '_delegate';
15const NAV_DEPTH = '_navDepth';
16const TRANSITION = '_transition';
17const NON_ANIMATED_TRANSITION = 'non-animated';
18let navDepth = -1;
19export class Frame extends FrameBase {
20 constructor() {
21 super();
22 this._ios = new iOSFrame(this);
23 this.viewController = this._ios.controller;
24 }
25 createNativeView() {
26 return this.viewController.view;
27 }
28 disposeNativeView() {
29 this._removeFromFrameStack();
30 this.viewController = null;
31 this._animatedDelegate = null;
32 if (this._ios) {
33 this._ios.controller = null;
34 this._ios = null;
35 }
36 super.disposeNativeView();
37 }
38 // @ts-ignore
39 get ios() {
40 return this._ios;
41 }
42 setCurrent(entry, navigationType) {
43 const current = this._currentEntry;
44 const currentEntryChanged = current !== entry;
45 if (entry?.resolvedPage && currentEntryChanged) {
46 this._updateBackstack(entry, navigationType);
47 super.setCurrent(entry, navigationType);
48 }
49 }
50 // !!! THIS PROFILE DECORATOR CREATES A CIRCULAR DEPENDENCY
51 // !!! BECAUSE THE PARAMETER TYPE IS EVALUATED WITH TYPEOF
52 _navigateCore(backstackEntry) {
53 super._navigateCore(backstackEntry);
54 const viewController = backstackEntry.resolvedPage.ios;
55 if (!viewController) {
56 throw new Error('Required page does not have a viewController created.');
57 }
58 const clearHistory = backstackEntry.entry.clearHistory;
59 if (clearHistory) {
60 navDepth = -1;
61 }
62 const isReplace = this._executingContext && this._executingContext.navigationType === NavigationType.replace;
63 if (!isReplace) {
64 navDepth++;
65 }
66 let navigationTransition;
67 const animated = this.currentPage ? this._getIsAnimatedNavigation(backstackEntry.entry) : false;
68 if (animated) {
69 navigationTransition = this._getNavigationTransition(backstackEntry.entry);
70 if (navigationTransition) {
71 viewController[TRANSITION] = navigationTransition;
72 }
73 }
74 else {
75 //https://github.com/NativeScript/NativeScript/issues/1787
76 viewController[TRANSITION] = { name: NON_ANIMATED_TRANSITION };
77 }
78 const nativeTransition = _getNativeTransition(navigationTransition, true);
79 if (!nativeTransition && navigationTransition) {
80 if (!this._animatedDelegate) {
81 this._animatedDelegate = UINavigationControllerAnimatedDelegate.initWithOwner(new WeakRef(this));
82 }
83 this._ios.controller.delegate = this._animatedDelegate;
84 viewController[DELEGATE] = this._animatedDelegate;
85 if (navigationTransition.instance) {
86 this.transitionId = navigationTransition.instance.id;
87 const transitionState = SharedTransition.getState(this.transitionId);
88 if (transitionState?.interactive?.dismiss) {
89 // interactive transitions via gestures
90 // TODO - allow users to define their own custom gesture dismissals
91 navigationTransition.instance.setupInteractiveGesture(() => {
92 this._ios.controller.popViewControllerAnimated(true);
93 }, this);
94 }
95 }
96 }
97 else {
98 viewController[DELEGATE] = null;
99 this._ios.controller.delegate = null;
100 }
101 backstackEntry[NAV_DEPTH] = navDepth;
102 viewController[ENTRY] = backstackEntry;
103 if (!animated && majorVersion > 10) {
104 // Reset back button title before pushing view controller to prevent
105 // displaying default 'back' title (when NavigaitonButton custom title is set).
106 const barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction('', 0 /* UIBarButtonItemStyle.Plain */, null, null);
107 viewController.navigationItem.backBarButtonItem = barButtonItem;
108 }
109 // First navigation.
110 if (!this._currentEntry) {
111 // Update action-bar with disabled animations before the initial navigation.
112 this._updateActionBar(backstackEntry.resolvedPage, true);
113 // Core defaults modalPresentationStyle to 1 for standard frame navigation
114 // for all others, it's modal presentation
115 this.pushViewControllerAnimated(viewController, animated, this._ios?.controller?.modalPresentationStyle !== 1);
116 if (Trace.isEnabled()) {
117 Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
118 }
119 return;
120 }
121 // We should clear the entire history.
122 if (clearHistory) {
123 viewController.navigationItem.hidesBackButton = true;
124 const newControllers = NSMutableArray.alloc().initWithCapacity(1);
125 newControllers.addObject(viewController);
126 // Mark all previous ViewControllers as cleared
127 const oldControllers = this._ios.controller.viewControllers;
128 for (let i = 0; i < oldControllers.count; i++) {
129 oldControllers.objectAtIndex(i).isBackstackCleared = true;
130 }
131 this._ios.controller.setViewControllersAnimated(newControllers, animated);
132 if (Trace.isEnabled()) {
133 Trace.write(`${this}.setViewControllersAnimated([${viewController}], ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
134 }
135 return;
136 }
137 // We should hide the current entry from the back stack.
138 // This is the case for HMR when NavigationType.replace.
139 if (!Frame._isEntryBackstackVisible(this._currentEntry) || isReplace) {
140 const newControllers = NSMutableArray.alloc().initWithArray(this._ios.controller.viewControllers);
141 if (newControllers.count === 0) {
142 throw new Error('Wrong controllers count.');
143 }
144 // the code below fixes a phantom animation that appears on the Back button in this case
145 // TODO: investigate why the animation happens at first place before working around it
146 viewController.navigationItem.hidesBackButton = this.backStack.length === 0;
147 // swap the top entry with the new one
148 const skippedNavController = newControllers.lastObject;
149 skippedNavController.isBackstackSkipped = true;
150 newControllers.removeLastObject();
151 newControllers.addObject(viewController);
152 // replace the controllers instead of pushing directly
153 this._ios.controller.setViewControllersAnimated(newControllers, animated);
154 if (Trace.isEnabled()) {
155 Trace.write(`${this}.setViewControllersAnimated([originalControllers - lastController + ${viewController}], ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
156 }
157 return;
158 }
159 // General case.
160 this._ios.controller.pushViewControllerAnimated(viewController, animated);
161 if (Trace.isEnabled()) {
162 Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
163 }
164 }
165 pushViewControllerAnimated(viewController, animated, isModal) {
166 const transitionCoordinator = this._ios.controller.transitionCoordinator;
167 if (!isModal && transitionCoordinator) {
168 transitionCoordinator.animateAlongsideTransitionCompletion(null, () => {
169 this._ios.controller.pushViewControllerAnimated(viewController, animated);
170 });
171 }
172 else {
173 // modal should always push immediately without transition coordinator
174 this._ios.controller.pushViewControllerAnimated(viewController, animated);
175 }
176 }
177 _goBackCore(backstackEntry) {
178 super._goBackCore(backstackEntry);
179 navDepth = backstackEntry[NAV_DEPTH];
180 const controller = backstackEntry.resolvedPage.ios;
181 const animated = this._currentEntry ? this._getIsAnimatedNavigation(this._currentEntry.entry) : false;
182 this._updateActionBar(backstackEntry.resolvedPage);
183 if (Trace.isEnabled()) {
184 Trace.write(`${this}.popToViewControllerAnimated(${controller}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
185 }
186 this._ios.controller.popToViewControllerAnimated(controller, animated);
187 }
188 _updateActionBar(page, disableNavBarAnimation = false) {
189 super._updateActionBar(page);
190 if (page && this.currentPage && this.currentPage.modal === page) {
191 return;
192 }
193 page = page || this.currentPage;
194 const newValue = this._getNavBarVisible(page);
195 const disableNavBarAnimationCache = this._ios._disableNavBarAnimation;
196 if (disableNavBarAnimation) {
197 this._ios._disableNavBarAnimation = true;
198 }
199 // when showing/hiding navigationbar, the page needs a relayout to avoid overlapping or hidden layouts
200 const needsPageLayout = this._ios.showNavigationBar !== newValue;
201 this._ios.showNavigationBar = newValue;
202 if (disableNavBarAnimation) {
203 this._ios._disableNavBarAnimation = disableNavBarAnimationCache;
204 }
205 if (this._ios.controller?.navigationBar) {
206 this._ios.controller.navigationBar.userInteractionEnabled = this.navigationQueueIsEmpty();
207 }
208 if (needsPageLayout && page) {
209 page.requestLayout();
210 }
211 }
212 _getNavBarVisible(page) {
213 switch (this.actionBarVisibility) {
214 case 'always':
215 return true;
216 case 'never':
217 return false;
218 case 'auto':
219 switch (this._ios.navBarVisibility) {
220 case 'always':
221 return true;
222 case 'never':
223 return false;
224 case 'auto': {
225 let newValue;
226 if (page && page.actionBarHidden !== undefined) {
227 newValue = !page.actionBarHidden;
228 }
229 else {
230 newValue = this.ios.controller.viewControllers.count > 1 || (page && page.actionBar && !page.actionBar._isEmpty());
231 }
232 newValue = !!newValue;
233 return newValue;
234 }
235 }
236 }
237 }
238 static get defaultAnimatedNavigation() {
239 return FrameBase.defaultAnimatedNavigation;
240 }
241 static set defaultAnimatedNavigation(value) {
242 FrameBase.defaultAnimatedNavigation = value;
243 }
244 static get defaultTransition() {
245 return FrameBase.defaultTransition;
246 }
247 static set defaultTransition(value) {
248 FrameBase.defaultTransition = value;
249 }
250 onMeasure(widthMeasureSpec, heightMeasureSpec) {
251 const width = layout.getMeasureSpecSize(widthMeasureSpec);
252 const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
253 const height = layout.getMeasureSpecSize(heightMeasureSpec);
254 const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
255 const widthAndState = View.resolveSizeAndState(width, width, widthMode, 0);
256 const heightAndState = View.resolveSizeAndState(height, height, heightMode, 0);
257 this.setMeasuredDimension(widthAndState, heightAndState);
258 }
259 layoutNativeView(left, top, right, bottom) {
260 //
261 }
262 _setNativeViewFrame(nativeView, frame) {
263 //
264 }
265 _onNavigatingTo(backstackEntry, isBack) {
266 // for now to not break iOS events chain (calling navigation events from controller delegates)
267 // we dont call super(which would also trigger events) but only notify the frame of the navigation
268 // though it means events are not triggered at the same time (lifecycle) on iOS / Android
269 this.notify({
270 eventName: Page.navigatingToEvent,
271 object: this,
272 isBack,
273 entry: backstackEntry,
274 fromEntry: this._currentEntry,
275 });
276 }
277}
278__decorate([
279 profile,
280 __metadata("design:type", Function),
281 __metadata("design:paramtypes", [Object]),
282 __metadata("design:returntype", void 0)
283], Frame.prototype, "_navigateCore", null);
284const transitionDelegates = new Array();
285var TransitionDelegate = /** @class */ (function (_super) {
286 __extends(TransitionDelegate, _super);
287 function TransitionDelegate() {
288 return _super !== null && _super.apply(this, arguments) || this;
289 }
290 TransitionDelegate.initWithOwnerId = function (id) {
291 var delegate = TransitionDelegate.new();
292 delegate._id = id;
293 transitionDelegates.push(delegate);
294 return delegate;
295 };
296 TransitionDelegate.prototype.animationWillStart = function (animationID, context) {
297 if (Trace.isEnabled()) {
298 Trace.write("START ".concat(this._id), Trace.categories.Transition);
299 }
300 };
301 TransitionDelegate.prototype.animationDidStop = function (animationID, finished, context) {
302 if (finished) {
303 if (Trace.isEnabled()) {
304 Trace.write("END ".concat(this._id), Trace.categories.Transition);
305 }
306 }
307 else {
308 if (Trace.isEnabled()) {
309 Trace.write("CANCEL ".concat(this._id), Trace.categories.Transition);
310 }
311 }
312 var index = transitionDelegates.indexOf(this);
313 if (index > -1) {
314 transitionDelegates.splice(index, 1);
315 }
316 };
317 TransitionDelegate.ObjCExposedMethods = {
318 animationWillStart: {
319 returns: interop.types.void,
320 params: [NSString, NSObject],
321 },
322 animationDidStop: {
323 returns: interop.types.void,
324 params: [NSString, NSNumber, NSObject],
325 },
326 };
327 return TransitionDelegate;
328}(NSObject));
329var UINavigationControllerAnimatedDelegate = /** @class */ (function (_super) {
330 __extends(UINavigationControllerAnimatedDelegate, _super);
331 function UINavigationControllerAnimatedDelegate() {
332 return _super !== null && _super.apply(this, arguments) || this;
333 }
334 UINavigationControllerAnimatedDelegate.initWithOwner = function (owner) {
335 var delegate = UINavigationControllerAnimatedDelegate.new();
336 delegate.owner = owner;
337 return delegate;
338 };
339 UINavigationControllerAnimatedDelegate.prototype.navigationControllerAnimationControllerForOperationFromViewControllerToViewController = function (navigationController, operation, fromVC, toVC) {
340 var _a;
341 var viewController;
342 switch (operation) {
343 case UINavigationControllerOperation.Push:
344 viewController = toVC;
345 break;
346 case UINavigationControllerOperation.Pop:
347 viewController = fromVC;
348 break;
349 }
350 if (!viewController) {
351 return null;
352 }
353 var navigationTransition = viewController[TRANSITION];
354 if (!navigationTransition) {
355 return null;
356 }
357 if (Trace.isEnabled()) {
358 Trace.write("UINavigationControllerImpl.navigationControllerAnimationControllerForOperationFromViewControllerToViewController(".concat(operation, ", ").concat(fromVC, ", ").concat(toVC, "), transition: ").concat(JSON.stringify(navigationTransition)), Trace.categories.NativeLifecycle);
359 }
360 this.transition = navigationTransition.instance;
361 if (!this.transition) {
362 if (navigationTransition.name) {
363 var curve = _getNativeCurve(navigationTransition);
364 var name = navigationTransition.name.toLowerCase();
365 if (name.indexOf('slide') === 0) {
366 var direction = name.substring('slide'.length) || 'left'; //Extract the direction from the string
367 this.transition = new SlideTransition(direction, navigationTransition.duration, curve);
368 }
369 else if (name === 'fade') {
370 this.transition = new FadeTransition(navigationTransition.duration, curve);
371 }
372 }
373 }
374 if ((_a = this.transition) === null || _a === void 0 ? void 0 : _a.iosNavigatedController) {
375 return this.transition.iosNavigatedController(navigationController, operation, fromVC, toVC);
376 }
377 return null;
378 };
379 UINavigationControllerAnimatedDelegate.prototype.navigationControllerInteractionControllerForAnimationController = function (navigationController, animationController) {
380 var _a, _b, _c;
381 var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.deref();
382 if (owner) {
383 var state = SharedTransition.getState(owner.transitionId);
384 if ((_b = state === null || state === void 0 ? void 0 : state.instance) === null || _b === void 0 ? void 0 : _b.iosInteractionDismiss) {
385 if (state === null || state === void 0 ? void 0 : state.interactiveBegan) {
386 return (_c = state === null || state === void 0 ? void 0 : state.instance) === null || _c === void 0 ? void 0 : _c.iosInteractionDismiss(null);
387 }
388 }
389 }
390 return null;
391 };
392 UINavigationControllerAnimatedDelegate.ObjCProtocols = [UINavigationControllerDelegate];
393 return UINavigationControllerAnimatedDelegate;
394}(NSObject));
395var UINavigationControllerImpl = /** @class */ (function (_super) {
396 __extends(UINavigationControllerImpl, _super);
397 function UINavigationControllerImpl() {
398 return _super !== null && _super.apply(this, arguments) || this;
399 }
400 UINavigationControllerImpl.initWithOwner = function (owner) {
401 var _a, _b, _c, _d;
402 var navigationBarClass = (_b = (_a = owner.deref()) === null || _a === void 0 ? void 0 : _a.iosNavigationBarClass) !== null && _b !== void 0 ? _b : null;
403 var toolbarClass = (_d = (_c = owner.deref()) === null || _c === void 0 ? void 0 : _c.iosToolbarClass) !== null && _d !== void 0 ? _d : null;
404 var controller = navigationBarClass || toolbarClass ? UINavigationControllerImpl.alloc().initWithNavigationBarClassToolbarClass(navigationBarClass, toolbarClass) : UINavigationControllerImpl.new();
405 controller._owner = owner;
406 return controller;
407 };
408 Object.defineProperty(UINavigationControllerImpl.prototype, "owner", {
409 get: function () {
410 var _a, _b;
411 return (_b = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.deref) === null || _b === void 0 ? void 0 : _b.call(_a);
412 },
413 enumerable: true,
414 configurable: true
415 });
416 UINavigationControllerImpl.prototype.viewWillAppear = function (animated) {
417 var _a, _b;
418 _super.prototype.viewWillAppear.call(this, animated);
419 var owner = (_b = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.deref) === null || _b === void 0 ? void 0 : _b.call(_a);
420 if (owner && !owner.isLoaded && !owner.parent) {
421 owner.callLoaded();
422 }
423 };
424 UINavigationControllerImpl.prototype.viewDidDisappear = function (animated) {
425 var _a, _b;
426 _super.prototype.viewDidDisappear.call(this, animated);
427 var owner = (_b = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.deref) === null || _b === void 0 ? void 0 : _b.call(_a);
428 if (owner && owner.isLoaded && !owner.parent && !this.presentedViewController) {
429 owner.callUnloaded();
430 owner._tearDownUI(true);
431 }
432 };
433 UINavigationControllerImpl.prototype.animateWithDuration = function (navigationTransition, nativeTransition, transitionType, baseCallback) {
434 var _this = this;
435 var duration = navigationTransition.duration ? navigationTransition.duration / 1000 : CORE_ANIMATION_DEFAULTS.duration;
436 var curve = _getNativeCurve(navigationTransition);
437 var transitionTraced = Trace.isCategorySet(Trace.categories.Transition);
438 var transitionDelegate;
439 if (transitionTraced) {
440 var id = _getTransitionId(nativeTransition, transitionType);
441 transitionDelegate = TransitionDelegate.initWithOwnerId(id);
442 }
443 UIView.animateWithDurationAnimations(duration, function () {
444 if (transitionTraced) {
445 UIView.setAnimationDelegate(transitionDelegate);
446 }
447 UIView.setAnimationWillStartSelector('animationWillStart');
448 UIView.setAnimationDidStopSelector('animationDidStop');
449 UIView.setAnimationCurve(curve);
450 baseCallback();
451 UIView.setAnimationTransitionForViewCache(nativeTransition, _this.view, true);
452 });
453 };
454 UINavigationControllerImpl.prototype.pushViewControllerAnimated = function (viewController, animated) {
455 var _this = this;
456 var navigationTransition = viewController[TRANSITION];
457 if (Trace.isEnabled()) {
458 Trace.write("UINavigationControllerImpl.pushViewControllerAnimated(".concat(viewController, ", ").concat(animated, "); transition: ").concat(JSON.stringify(navigationTransition)), Trace.categories.NativeLifecycle);
459 }
460 var nativeTransition = _getNativeTransition(navigationTransition, true);
461 if (!animated || !navigationTransition || !nativeTransition) {
462 _super.prototype.pushViewControllerAnimated.call(this, viewController, animated);
463 return;
464 }
465 this.animateWithDuration(navigationTransition, nativeTransition, 'push', function () {
466 _super.prototype.pushViewControllerAnimated.call(_this, viewController, false);
467 });
468 };
469 UINavigationControllerImpl.prototype.setViewControllersAnimated = function (viewControllers, animated) {
470 var _this = this;
471 var viewController = viewControllers.lastObject;
472 var navigationTransition = viewController[TRANSITION];
473 if (Trace.isEnabled()) {
474 Trace.write("UINavigationControllerImpl.setViewControllersAnimated(".concat(viewControllers, ", ").concat(animated, "); transition: ").concat(JSON.stringify(navigationTransition)), Trace.categories.NativeLifecycle);
475 }
476 var nativeTransition = _getNativeTransition(navigationTransition, true);
477 if (!animated || !navigationTransition || !nativeTransition) {
478 _super.prototype.setViewControllersAnimated.call(this, viewControllers, animated);
479 return;
480 }
481 this.animateWithDuration(navigationTransition, nativeTransition, 'set', function () {
482 _super.prototype.setViewControllersAnimated.call(_this, viewControllers, false);
483 });
484 };
485 UINavigationControllerImpl.prototype.popViewControllerAnimated = function (animated) {
486 var _this = this;
487 var lastViewController = this.viewControllers.lastObject;
488 var navigationTransition = lastViewController[TRANSITION];
489 if (Trace.isEnabled()) {
490 Trace.write("UINavigationControllerImpl.popViewControllerAnimated(".concat(animated, "); transition: ").concat(JSON.stringify(navigationTransition)), Trace.categories.NativeLifecycle);
491 }
492 if (navigationTransition && navigationTransition.name === NON_ANIMATED_TRANSITION) {
493 //https://github.com/NativeScript/NativeScript/issues/1787
494 return _super.prototype.popViewControllerAnimated.call(this, false);
495 }
496 var nativeTransition = _getNativeTransition(navigationTransition, false);
497 if (!animated || !navigationTransition || !nativeTransition) {
498 return _super.prototype.popViewControllerAnimated.call(this, animated);
499 }
500 this.animateWithDuration(navigationTransition, nativeTransition, 'pop', function () {
501 _super.prototype.popViewControllerAnimated.call(_this, false);
502 });
503 return null;
504 };
505 UINavigationControllerImpl.prototype.popToViewControllerAnimated = function (viewController, animated) {
506 var _this = this;
507 var lastViewController = this.viewControllers.lastObject;
508 var navigationTransition = lastViewController[TRANSITION];
509 if (Trace.isEnabled()) {
510 Trace.write("UINavigationControllerImpl.popToViewControllerAnimated(".concat(viewController, ", ").concat(animated, "); transition: ").concat(JSON.stringify(navigationTransition)), Trace.categories.NativeLifecycle);
511 }
512 if (navigationTransition && navigationTransition.name === NON_ANIMATED_TRANSITION) {
513 //https://github.com/NativeScript/NativeScript/issues/1787
514 return _super.prototype.popToViewControllerAnimated.call(this, viewController, false);
515 }
516 var nativeTransition = _getNativeTransition(navigationTransition, false);
517 if (!animated || !navigationTransition || !nativeTransition) {
518 return _super.prototype.popToViewControllerAnimated.call(this, viewController, animated);
519 }
520 this.animateWithDuration(navigationTransition, nativeTransition, 'popTo', function () {
521 _super.prototype.popToViewControllerAnimated.call(_this, viewController, false);
522 });
523 return null;
524 };
525 // Mind implementation for other controllers
526 UINavigationControllerImpl.prototype.traitCollectionDidChange = function (previousTraitCollection) {
527 var _a, _b;
528 _super.prototype.traitCollectionDidChange.call(this, previousTraitCollection);
529 if (majorVersion >= 13) {
530 var owner = (_b = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.deref) === null || _b === void 0 ? void 0 : _b.call(_a);
531 if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
532 owner.notify({
533 eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent,
534 object: owner,
535 });
536 }
537 }
538 };
539 var _a, _b;
540 __decorate([
541 profile,
542 __metadata("design:type", Function),
543 __metadata("design:paramtypes", [Boolean]),
544 __metadata("design:returntype", void 0)
545 ], UINavigationControllerImpl.prototype, "viewWillAppear", null);
546 __decorate([
547 profile,
548 __metadata("design:type", Function),
549 __metadata("design:paramtypes", [Boolean]),
550 __metadata("design:returntype", void 0)
551 ], UINavigationControllerImpl.prototype, "viewDidDisappear", null);
552 __decorate([
553 profile,
554 __metadata("design:type", Function),
555 __metadata("design:paramtypes", [typeof (_a = typeof UIViewController !== "undefined" && UIViewController) === "function" ? _a : Object, Boolean]),
556 __metadata("design:returntype", void 0)
557 ], UINavigationControllerImpl.prototype, "pushViewControllerAnimated", null);
558 __decorate([
559 profile,
560 __metadata("design:type", Function),
561 __metadata("design:paramtypes", [typeof (_b = typeof NSArray !== "undefined" && NSArray) === "function" ? _b : Object, Boolean]),
562 __metadata("design:returntype", void 0)
563 ], UINavigationControllerImpl.prototype, "setViewControllersAnimated", null);
564 return UINavigationControllerImpl;
565}(UINavigationController));
566function _getTransitionId(nativeTransition, transitionType) {
567 let name;
568 switch (nativeTransition) {
569 case 4 /* UIViewAnimationTransition.CurlDown */:
570 name = 'CurlDown';
571 break;
572 case 3 /* UIViewAnimationTransition.CurlUp */:
573 name = 'CurlUp';
574 break;
575 case 1 /* UIViewAnimationTransition.FlipFromLeft */:
576 name = 'FlipFromLeft';
577 break;
578 case 2 /* UIViewAnimationTransition.FlipFromRight */:
579 name = 'FlipFromRight';
580 break;
581 case 0 /* UIViewAnimationTransition.None */:
582 name = 'None';
583 break;
584 }
585 return `${name} ${transitionType}`;
586}
587function _getNativeTransition(navigationTransition, push) {
588 if (navigationTransition && navigationTransition.name) {
589 switch (navigationTransition.name.toLowerCase()) {
590 case 'flip':
591 case 'flipright':
592 return push ? 2 /* UIViewAnimationTransition.FlipFromRight */ : 1 /* UIViewAnimationTransition.FlipFromLeft */;
593 case 'flipleft':
594 return push ? 1 /* UIViewAnimationTransition.FlipFromLeft */ : 2 /* UIViewAnimationTransition.FlipFromRight */;
595 case 'curl':
596 case 'curlup':
597 return push ? 3 /* UIViewAnimationTransition.CurlUp */ : 4 /* UIViewAnimationTransition.CurlDown */;
598 case 'curldown':
599 return push ? 4 /* UIViewAnimationTransition.CurlDown */ : 3 /* UIViewAnimationTransition.CurlUp */;
600 }
601 }
602 return null;
603}
604export function _getNativeCurve(transition) {
605 if (transition.curve) {
606 switch (transition.curve) {
607 case 'easeIn':
608 if (Trace.isEnabled()) {
609 Trace.write('Transition curve resolved to UIViewAnimationCurve.EaseIn.', Trace.categories.Transition);
610 }
611 return 1 /* UIViewAnimationCurve.EaseIn */;
612 case 'easeOut':
613 if (Trace.isEnabled()) {
614 Trace.write('Transition curve resolved to UIViewAnimationCurve.EaseOut.', Trace.categories.Transition);
615 }
616 return 2 /* UIViewAnimationCurve.EaseOut */;
617 case 'easeInOut':
618 if (Trace.isEnabled()) {
619 Trace.write('Transition curve resolved to UIViewAnimationCurve.EaseInOut.', Trace.categories.Transition);
620 }
621 return 0 /* UIViewAnimationCurve.EaseInOut */;
622 case 'linear':
623 if (Trace.isEnabled()) {
624 Trace.write('Transition curve resolved to UIViewAnimationCurve.Linear.', Trace.categories.Transition);
625 }
626 return 3 /* UIViewAnimationCurve.Linear */;
627 default:
628 if (Trace.isEnabled()) {
629 Trace.write('Transition curve resolved to original: ' + transition.curve, Trace.categories.Transition);
630 }
631 return transition.curve;
632 }
633 }
634 return 0 /* UIViewAnimationCurve.EaseInOut */;
635}
636/* tslint:disable */
637class iOSFrame {
638 constructor(frame) {
639 this._navBarVisibility = 'auto';
640 this._controller = UINavigationControllerImpl.initWithOwner(new WeakRef(frame));
641 }
642 get controller() {
643 return this._controller;
644 }
645 set controller(value) {
646 this._controller = value;
647 }
648 get showNavigationBar() {
649 return this._showNavigationBar;
650 }
651 set showNavigationBar(value) {
652 this._showNavigationBar = value;
653 if (this._controller) {
654 this._controller.setNavigationBarHiddenAnimated(!value, !this._disableNavBarAnimation);
655 }
656 }
657 get navBarVisibility() {
658 return this._navBarVisibility;
659 }
660 set navBarVisibility(value) {
661 this._navBarVisibility = value;
662 }
663}
664export function setActivityCallbacks(activity) { }
665//# sourceMappingURL=index.ios.js.map
\No newline at end of file