@@ -22,7 +22,16 @@ import { swipeEnabledProperty, TabsBase } from "./tabs-common";
2222export * from "./tabs-common" ;
2323
2424const majorVersion = iosUtils . MajorVersion ;
25- // const isPhone = device.deviceType === "Phone";
25+
26+ // Equivalent to dispatch_async(dispatch_get_main_queue(...)) call
27+ const invokeOnRunLoop = ( function ( ) {
28+ const runloop = CFRunLoopGetMain ( ) ;
29+
30+ return ( action : ( ) => any ) => {
31+ CFRunLoopPerformBlock ( runloop , kCFRunLoopDefaultMode , action ) ;
32+ CFRunLoopWakeUp ( runloop ) ;
33+ } ;
34+ } ( ) ) ;
2635
2736class MDCTabBarDelegateImpl extends NSObject implements MDCTabBarDelegate {
2837 public static ObjCProtocols = [ MDCTabBarDelegate ] ;
@@ -1052,6 +1061,11 @@ export class Tabs extends TabsBase {
10521061 this . _currentNativeSelectedIndex = value ;
10531062 this . viewController . setViewControllersDirectionAnimatedCompletion ( controllers , navigationDirection , true , ( finished : boolean ) => {
10541063 if ( finished ) {
1064+ if ( majorVersion < 10 ) {
1065+ // HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606
1066+ invokeOnRunLoop ( ( ) => this . viewController . setViewControllersDirectionAnimatedCompletion ( controllers , navigationDirection , false , null ) ) ;
1067+ }
1068+
10551069 this . _canSelectItem = true ;
10561070 this . _setCanBeLoaded ( value ) ;
10571071 this . _loadUnloadTabItems ( value ) ;
0 commit comments