diff --git a/tests/app/ui/image-cache/image-cache-tests.ts b/tests/app/ui/image-cache/image-cache-tests.ts index c5c66b69d..3e9b73f44 100644 --- a/tests/app/ui/image-cache/image-cache-tests.ts +++ b/tests/app/ui/image-cache/image-cache-tests.ts @@ -1,6 +1,7 @@ import * as imageCacheModule from "tns-core-modules/ui/image-cache"; import * as imageSource from "tns-core-modules/image-source"; import * as types from "tns-core-modules/utils/types"; +import { isAndroid } from "tns-core-modules/platform"; import { device } from "tns-core-modules/platform"; import lazy from "tns-core-modules/utils/lazy"; @@ -10,7 +11,7 @@ const sdkVersion = lazy(() => parseInt(device.sdkVersion)); export const test_ImageCache_ValidUrl = function() { // see https://github.com/NativeScript/NativeScript/issues/6643 - if (sdkVersion() < 20) { + if (isAndroid && sdkVersion() < 20) { return; } diff --git a/tests/app/xml-parser-tests/xml-parser-tests.ts b/tests/app/xml-parser-tests/xml-parser-tests.ts index e1949ba1c..65f9e81d8 100644 --- a/tests/app/xml-parser-tests/xml-parser-tests.ts +++ b/tests/app/xml-parser-tests/xml-parser-tests.ts @@ -6,6 +6,11 @@ import * as TKUnit from "../tk-unit"; import * as xmlModule from "tns-core-modules/xml"; import * as fs from "tns-core-modules/file-system"; import * as builder from "tns-core-modules/ui/builder"; +import { isIOS } from "tns-core-modules/platform"; +import { device } from "tns-core-modules/platform"; +import lazy from "tns-core-modules/utils/lazy"; + +const sdkVersion = lazy(() => parseInt(device.sdkVersion)); export var test_XmlParser_IsDefined = function () { TKUnit.assertNotEqual(xmlModule.XmlParser, undefined, "Class XmlParser should be defined!"); @@ -94,6 +99,10 @@ export var test_XmlParser_OnErrorIsCalledWhenAnErrorOccurs = function () { }; export var test_XmlParser_IntegrationTest = function () { + if (isIOS && sdkVersion() < 10) { + return; + } + var actualResult = ""; var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) { if (event.eventType === xmlModule.ParserEventType.Text && event.data.trim() === "") { @@ -194,6 +203,10 @@ export var test_XmlParser_DummyDocumentationTest = function () { }; export var test_XmlParser_NamespacesTest = function () { + if (isIOS && sdkVersion() < 10) { + return; + } + var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) { if (event.eventType !== xmlModule.ParserEventType.StartElement) { return; diff --git a/tns-core-modules/ui/tabs/tabs.ios.ts b/tns-core-modules/ui/tabs/tabs.ios.ts index be26ca1b0..f660e514b 100644 --- a/tns-core-modules/ui/tabs/tabs.ios.ts +++ b/tns-core-modules/ui/tabs/tabs.ios.ts @@ -22,7 +22,16 @@ import { swipeEnabledProperty, TabsBase } from "./tabs-common"; export * from "./tabs-common"; const majorVersion = iosUtils.MajorVersion; -// const isPhone = device.deviceType === "Phone"; + +// Equivalent to dispatch_async(dispatch_get_main_queue(...)) call +const invokeOnRunLoop = (function() { + const runloop = CFRunLoopGetMain(); + + return (action: () => any) => { + CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, action); + CFRunLoopWakeUp(runloop); + }; +}()); class MDCTabBarDelegateImpl extends NSObject implements MDCTabBarDelegate { public static ObjCProtocols = [MDCTabBarDelegate]; @@ -1052,6 +1061,11 @@ export class Tabs extends TabsBase { this._currentNativeSelectedIndex = value; this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, true, (finished: boolean) => { if (finished) { + if (majorVersion < 10) { + // HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606 + invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, false, null)); + } + this._canSelectItem = true; this._setCanBeLoaded(value); this._loadUnloadTabItems(value);