From b3f9c0d0ac656f413653d79d5eb9fcb1a6e1ca0f Mon Sep 17 00:00:00 2001 From: Nathanael Anderson Date: Wed, 11 Nov 2020 01:11:31 -0600 Subject: [PATCH] fix(ios): ios 10 tab crash (#9018) * Fix: ios10 tab crash * Fix iOS 14 tests that crash because of changes in the way ios 14 works. --- packages/core/ui/tabs/index.ios.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/core/ui/tabs/index.ios.ts b/packages/core/ui/tabs/index.ios.ts index c3681f6be..e5723d8dd 100644 --- a/packages/core/ui/tabs/index.ios.ts +++ b/packages/core/ui/tabs/index.ios.ts @@ -1119,16 +1119,31 @@ export class Tabs extends TabsBase { // do not make layout changes while the animation is in progress https://stackoverflow.com/a/47031524/613113 this.visitFrames(item, (frame) => (frame._animationInProgress = true)); + const doneAnimating = () => { + this.visitFrames(item, (frame) => (frame._animationInProgress = false)); + + this._canSelectItem = true; + this._setCanBeLoaded(value); + this._loadUnloadTabItems(value); + }; + invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, this.animationEnabled, (finished: boolean) => { - this.visitFrames(item, (frame) => (frame._animationInProgress = false)); if (finished) { - // HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606 - invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, false, null)); + if (this.animationEnabled) { + // HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606 + // Prior Hack fails on iOS 10.3 during tests with v8 engine... + // Leaving the above link in case we need to special case this for only iOS > 10.3? - this._canSelectItem = true; - this._setCanBeLoaded(value); - this._loadUnloadTabItems(value); + // HACK: UIPageViewController fix; see https://stackoverflow.com/questions/15325891 + invokeOnRunLoop(() => { + this.viewController.dataSource = null; + (this.viewController).dataSource = this.viewController; + doneAnimating(); + }); + } else { + doneAnimating(); + } } }) );