mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(tabs-ios9): no view controller managing visible view error (#7837)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user