mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
chore: merge release to master
chore: merge release to master
This commit is contained in:
@ -27,5 +27,6 @@ export function loadExamples() {
|
|||||||
examples.set("tab-view-tab-text-font-size", "tab-view/tab-view-tab-text-font-size");
|
examples.set("tab-view-tab-text-font-size", "tab-view/tab-view-tab-text-font-size");
|
||||||
examples.set("tab-view-android-swipe", "tab-view/tab-view-android-swipe");
|
examples.set("tab-view-android-swipe", "tab-view/tab-view-android-swipe");
|
||||||
examples.set("tab-view-icon-title-placement", "tab-view/icon-title-placement");
|
examples.set("tab-view-icon-title-placement", "tab-view/icon-title-placement");
|
||||||
|
examples.set("tab-text-color", "tab-view/tab-text-color");
|
||||||
return examples;
|
return examples;
|
||||||
}
|
}
|
||||||
|
24
apps/app/ui-tests-app/tab-view/tab-text-color.xml
Normal file
24
apps/app/ui-tests-app/tab-view/tab-text-color.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<Page>
|
||||||
|
<TabView tabTextColor="red">
|
||||||
|
<TabView.items>
|
||||||
|
|
||||||
|
<TabViewItem title="Tab 1">
|
||||||
|
<TabViewItem.view>
|
||||||
|
<Label text="Label 1" />
|
||||||
|
</TabViewItem.view>
|
||||||
|
</TabViewItem>
|
||||||
|
|
||||||
|
<TabViewItem title="Tab 2">
|
||||||
|
<TabViewItem.view>
|
||||||
|
<Label text="Label 2" />
|
||||||
|
</TabViewItem.view>
|
||||||
|
</TabViewItem>
|
||||||
|
|
||||||
|
<TabViewItem title="Tab 3">
|
||||||
|
<TabViewItem.view>
|
||||||
|
<Label text="Label 3" />
|
||||||
|
</TabViewItem.view>
|
||||||
|
</TabViewItem>
|
||||||
|
</TabView.items>
|
||||||
|
</TabView>
|
||||||
|
</Page>
|
@ -1,7 +1,7 @@
|
|||||||
import * as application from "tns-core-modules/application";
|
import * as application from "tns-core-modules/application";
|
||||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||||
import { NavigatedData, Page } from "tns-core-modules/ui/page";
|
import { NavigatedData, Page } from "tns-core-modules/ui/page";
|
||||||
import { View, EventData } from "tns-core-modules/ui/core/view";
|
import { View, EventData, ShowModalOptions } from "tns-core-modules/ui/core/view";
|
||||||
import { Frame } from "tns-core-modules/ui/frame";
|
import { Frame } from "tns-core-modules/ui/frame";
|
||||||
|
|
||||||
export function onNavigatingTo(args: NavigatedData) {
|
export function onNavigatingTo(args: NavigatedData) {
|
||||||
@ -29,6 +29,20 @@ export function onModalNoPage(args: EventData) {
|
|||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function onPopoverModal(args: EventData) {
|
||||||
|
const view = args.object as View;
|
||||||
|
let options: ShowModalOptions = {
|
||||||
|
context: "context",
|
||||||
|
closeCallback: () => console.log("home-page modal popover frame closed"),
|
||||||
|
animated: false,
|
||||||
|
ios: {
|
||||||
|
presentationStyle: UIModalPresentationStyle.Popover
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
view.showModal("modal-no-page/modal-no-page", options);
|
||||||
|
}
|
||||||
|
|
||||||
export function onModalFrame(args: EventData) {
|
export function onModalFrame(args: EventData) {
|
||||||
const view = args.object as View;
|
const view = args.object as View;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<Button text="Show Modal Without Page" tap="onModalNoPage" textAlignment="left" />
|
<Button text="Show Modal Without Page" tap="onModalNoPage" textAlignment="left" />
|
||||||
<Button text="Show Modal Page With Frame" tap="onModalFrame" textAlignment="left" />
|
<Button text="Show Modal Page With Frame" tap="onModalFrame" textAlignment="left" />
|
||||||
<Button text="Show Modal Page" tap="onModalPage" textAlignment="left" />
|
<Button text="Show Modal Page" tap="onModalPage" textAlignment="left" />
|
||||||
|
<Button text="Show 'popover' modal" tap="onPopoverModal" textAlignment="left" />
|
||||||
<Button text="Show Modal Layout" tap="onModalLayout" textAlignment="left" />
|
<Button text="Show Modal Layout" tap="onModalLayout" textAlignment="left" />
|
||||||
<Button text="Show Modal TabView" tap="onModalTabView" textAlignment="left" />
|
<Button text="Show Modal TabView" tap="onModalTabView" textAlignment="left" />
|
||||||
<Button text="Android Back Btn Events" tap="onAndroidBackEvents" textAlignment="left" />
|
<Button text="Android Back Btn Events" tap="onAndroidBackEvents" textAlignment="left" />
|
||||||
|
@ -3,7 +3,7 @@ import { NavigatedData, Page } from "tns-core-modules/ui/page";
|
|||||||
import { View, EventData } from "tns-core-modules/ui/core/view";
|
import { View, EventData } from "tns-core-modules/ui/core/view";
|
||||||
import { Frame, ShownModallyData } from "tns-core-modules/ui/frame";
|
import { Frame, ShownModallyData } from "tns-core-modules/ui/frame";
|
||||||
import { fromObject } from "tns-core-modules/data/observable";
|
import { fromObject } from "tns-core-modules/data/observable";
|
||||||
import { confirm } from "ui/dialogs";
|
import { confirm } from "tns-core-modules/ui/dialogs";
|
||||||
|
|
||||||
export function onLoaded(args) {
|
export function onLoaded(args) {
|
||||||
console.log("modal-no-page loaded");
|
console.log("modal-no-page loaded");
|
||||||
|
@ -3,7 +3,7 @@ import { NavigatedData, Page } from "tns-core-modules/ui/page";
|
|||||||
import { View, EventData } from "tns-core-modules/ui/core/view";
|
import { View, EventData } from "tns-core-modules/ui/core/view";
|
||||||
import { Frame, ShownModallyData } from "tns-core-modules/ui/frame";
|
import { Frame, ShownModallyData } from "tns-core-modules/ui/frame";
|
||||||
import { fromObject } from "tns-core-modules/data/observable";
|
import { fromObject } from "tns-core-modules/data/observable";
|
||||||
import { confirm } from "ui/dialogs";
|
import { confirm } from "tns-core-modules/ui/dialogs";
|
||||||
|
|
||||||
export function onShowingModally(args: ShownModallyData) {
|
export function onShowingModally(args: ShownModallyData) {
|
||||||
console.log("modal-page showingModally");
|
console.log("modal-page showingModally");
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"nativescript-dev-appium": "next",
|
"nativescript-dev-appium": "next",
|
||||||
"nativescript-dev-typescript": "next",
|
"nativescript-dev-typescript": "next",
|
||||||
"nativescript-dev-webpack": "next",
|
"nativescript-dev-webpack": "next",
|
||||||
|
"tns-platform-declarations": "next",
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
"typescript": "^3.1.6"
|
"typescript": "^3.1.6"
|
||||||
},
|
},
|
||||||
|
1
e2e/modal-navigation/references.d.ts
vendored
Normal file
1
e2e/modal-navigation/references.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
|
@ -21,6 +21,7 @@ import {
|
|||||||
} from "../../gestures";
|
} from "../../gestures";
|
||||||
|
|
||||||
import { createViewFromEntry } from "../../builder";
|
import { createViewFromEntry } from "../../builder";
|
||||||
|
import { isAndroid } from "../../../platform";
|
||||||
import { StyleScope } from "../../styling/style-scope";
|
import { StyleScope } from "../../styling/style-scope";
|
||||||
import { LinearGradient } from "../../styling/linear-gradient";
|
import { LinearGradient } from "../../styling/linear-gradient";
|
||||||
import { BackgroundRepeat } from "../../styling/style-properties";
|
import { BackgroundRepeat } from "../../styling/style-properties";
|
||||||
@ -368,7 +369,11 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
that._hideNativeModalView(parent, whenClosedCallback);
|
if (isAndroid || (parent.viewController && parent.viewController.presentedViewController)) {
|
||||||
|
that._hideNativeModalView(parent, whenClosedCallback);
|
||||||
|
} else {
|
||||||
|
whenClosedCallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ const majorVersion = iosUtils.MajorVersion;
|
|||||||
export class View extends ViewCommon {
|
export class View extends ViewCommon {
|
||||||
nativeViewProtected: UIView;
|
nativeViewProtected: UIView;
|
||||||
viewController: UIViewController;
|
viewController: UIViewController;
|
||||||
|
private _popoverPresentationDelegate: ios.UIPopoverPresentationControllerDelegateImp;
|
||||||
|
|
||||||
private _isLaidOut = false;
|
private _isLaidOut = false;
|
||||||
private _hasTransfrom = false;
|
private _hasTransfrom = false;
|
||||||
@ -416,6 +417,8 @@ export class View extends ViewCommon {
|
|||||||
|
|
||||||
if (presentationStyle === UIModalPresentationStyle.Popover) {
|
if (presentationStyle === UIModalPresentationStyle.Popover) {
|
||||||
const popoverPresentationController = controller.popoverPresentationController;
|
const popoverPresentationController = controller.popoverPresentationController;
|
||||||
|
this._popoverPresentationDelegate = ios.UIPopoverPresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
|
||||||
|
popoverPresentationController.delegate = this._popoverPresentationDelegate;
|
||||||
const view = parent.nativeViewProtected;
|
const view = parent.nativeViewProtected;
|
||||||
// Note: sourceView and sourceRect are needed to specify the anchor location for the popover.
|
// Note: sourceView and sourceRect are needed to specify the anchor location for the popover.
|
||||||
// Note: sourceView should be the button triggering the modal. If it the Page the popover might appear "behind" the page content
|
// Note: sourceView should be the button triggering the modal. If it the Page the popover might appear "behind" the page content
|
||||||
@ -906,7 +909,7 @@ export namespace ios {
|
|||||||
|
|
||||||
public viewDidLoad(): void {
|
public viewDidLoad(): void {
|
||||||
super.viewDidLoad();
|
super.viewDidLoad();
|
||||||
|
|
||||||
// Unify translucent and opaque bars layout
|
// Unify translucent and opaque bars layout
|
||||||
// this.edgesForExtendedLayout = UIRectEdgeBottom;
|
// this.edgesForExtendedLayout = UIRectEdgeBottom;
|
||||||
this.extendedLayoutIncludesOpaqueBars = true;
|
this.extendedLayoutIncludesOpaqueBars = true;
|
||||||
@ -982,4 +985,26 @@ export namespace ios {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class UIPopoverPresentationControllerDelegateImp extends NSObject implements UIPopoverPresentationControllerDelegate {
|
||||||
|
public static ObjCProtocols = [UIPopoverPresentationControllerDelegate];
|
||||||
|
|
||||||
|
private owner: WeakRef<View>;
|
||||||
|
private closedCallback: Function;
|
||||||
|
|
||||||
|
public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp {
|
||||||
|
const instance = <UIPopoverPresentationControllerDelegateImp>super.new();
|
||||||
|
instance.owner = owner;
|
||||||
|
instance.closedCallback = whenClosedCallback;
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
|
||||||
|
const owner = this.owner.get();
|
||||||
|
if (owner && typeof this.closedCallback === "function") {
|
||||||
|
this.closedCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ function getTitleAttributesForStates(tabView: TabView): TabStates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tabSelectedItemTextColor = tabView.style.selectedTabTextColor;
|
const tabSelectedItemTextColor = tabView.style.selectedTabTextColor;
|
||||||
const selectedTextColor = tabItemTextColor instanceof Color ? tabSelectedItemTextColor.ios : null;
|
const selectedTextColor = tabSelectedItemTextColor instanceof Color ? tabSelectedItemTextColor.ios : null;
|
||||||
result.selectedState = { [NSFontAttributeName]: font }
|
result.selectedState = { [NSFontAttributeName]: font }
|
||||||
if (selectedTextColor) {
|
if (selectedTextColor) {
|
||||||
result.selectedState[UITextAttributeTextColor] = selectedTextColor
|
result.selectedState[UITextAttributeTextColor] = selectedTextColor
|
||||||
|
Reference in New Issue
Block a user