mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor(dark-mode): remove compatibility color module
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import { ActivityIndicatorBase, busyProperty, colorProperty, Color } from "./activity-indicator-common";
|
||||
import { activityIndicatorViewStyle } from "../../color/compatibility-colors.ios";
|
||||
|
||||
export * from "./activity-indicator-common";
|
||||
|
||||
import { ios } from "../../utils/utils";
|
||||
|
||||
const majorVersion = ios.MajorVersion;
|
||||
|
||||
export class ActivityIndicator extends ActivityIndicatorBase {
|
||||
nativeViewProtected: UIActivityIndicatorView;
|
||||
|
||||
private getActivityIndicatorViewStyle = () => majorVersion <= 12 ? UIActivityIndicatorViewStyle.Gray : UIActivityIndicatorViewStyle.Medium;
|
||||
|
||||
createNativeView() {
|
||||
const view = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(activityIndicatorViewStyle());
|
||||
const viewStyle = this.getActivityIndicatorViewStyle();
|
||||
const view = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(viewStyle);
|
||||
view.hidesWhenStopped = true;
|
||||
|
||||
return view;
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
PageBase, View, layout, actionBarHiddenProperty, statusBarStyleProperty, Color
|
||||
} from "./page-common";
|
||||
|
||||
import { backgroundColor } from "../../color/compatibility-colors.ios";
|
||||
import { profile } from "../../profiling";
|
||||
import { ios as iosUtils } from "../../utils/utils";
|
||||
|
||||
@@ -287,6 +286,8 @@ export class Page extends PageBase {
|
||||
nativeViewProtected: UIView;
|
||||
viewController: UIViewControllerImpl;
|
||||
|
||||
private getBackgroundColor = () => majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
|
||||
private _ios: UIViewControllerImpl;
|
||||
public _presentedViewController: UIViewController; // used when our page present native viewController without going through our abstraction.
|
||||
|
||||
@@ -296,7 +297,7 @@ export class Page extends PageBase {
|
||||
this.viewController = this._ios = controller;
|
||||
|
||||
// Make transitions look good
|
||||
controller.view.backgroundColor = backgroundColor();
|
||||
controller.view.backgroundColor = this.getBackgroundColor();
|
||||
}
|
||||
|
||||
createNativeView() {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { TextTransform } from "../text-base";
|
||||
|
||||
// Requires
|
||||
import { Color } from "../../color";
|
||||
import { backgroundColor, blueColor, labelColor } from "../../color/compatibility-colors.ios";
|
||||
import { fromFileOrResource, fromFontIconCode, ImageSource } from "../../image-source";
|
||||
import { ios as iosUtils, isFontIconURI, layout } from "../../utils/utils";
|
||||
import { ios as iosView, View } from "../core/view";
|
||||
@@ -25,6 +24,10 @@ export * from "./tabs-common";
|
||||
const majorVersion = iosUtils.MajorVersion;
|
||||
// const isPhone = device.deviceType === "Phone";
|
||||
|
||||
const getBackgroundColor = () => majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
const getBlueColor = () => majorVersion <= 12 ? UIColor.blueColor : UIColor.systemBlueColor;
|
||||
const getLabelColor = () => majorVersion <= 12 ? UIColor.blackColor : UIColor.labelColor;
|
||||
|
||||
class MDCTabBarDelegateImpl extends NSObject implements MDCTabBarDelegate {
|
||||
public static ObjCProtocols = [MDCTabBarDelegate];
|
||||
|
||||
@@ -91,10 +94,10 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
}
|
||||
|
||||
tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner));
|
||||
tabBar.tintColor = blueColor();
|
||||
tabBar.barTintColor = backgroundColor();
|
||||
tabBar.setTitleColorForState(labelColor(), MDCTabBarItemState.Normal);
|
||||
tabBar.setTitleColorForState(labelColor(), MDCTabBarItemState.Selected);
|
||||
tabBar.tintColor = getBlueColor();
|
||||
tabBar.barTintColor = getBackgroundColor();
|
||||
tabBar.setTitleColorForState(getLabelColor(), MDCTabBarItemState.Normal);
|
||||
tabBar.setTitleColorForState(getLabelColor(), MDCTabBarItemState.Selected);
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
tabBar.inkColor = UIColor.clearColor;
|
||||
|
||||
Reference in New Issue
Block a user