From ca7c46da3c69d0658b925258b32cf3e3289b6451 Mon Sep 17 00:00:00 2001 From: Nikolay Tsonev Date: Wed, 2 Oct 2019 16:49:20 +0300 Subject: [PATCH] feat(segmented-bar-ios): add support for the new selectedSegmentTintColor property (#7880) --- .../ui/segmented-bar/segmented-bar.ios.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tns-core-modules/ui/segmented-bar/segmented-bar.ios.ts b/tns-core-modules/ui/segmented-bar/segmented-bar.ios.ts index 962ea368a..dc8c78fdf 100644 --- a/tns-core-modules/ui/segmented-bar/segmented-bar.ios.ts +++ b/tns-core-modules/ui/segmented-bar/segmented-bar.ios.ts @@ -3,7 +3,7 @@ import { SegmentedBarItemBase, SegmentedBarBase, selectedIndexProperty, itemsProperty, selectedBackgroundColorProperty, colorProperty, fontInternalProperty, Color } from "./segmented-bar-common"; - +import { ios as iosUtils } from "../../utils/utils"; export * from "./segmented-bar-common"; export class SegmentedBarItem extends SegmentedBarItemBase { @@ -68,11 +68,19 @@ export class SegmentedBar extends SegmentedBarBase { } [selectedBackgroundColorProperty.getDefault](): UIColor { - return this.ios.tintColor; + const currentOsVersion = iosUtils.MajorVersion; + + return currentOsVersion < 13 ? this.ios.tintColor : this.ios.selectedSegmentTintColor; } [selectedBackgroundColorProperty.setNative](value: UIColor | Color) { + const currentOsVersion = iosUtils.MajorVersion; let color = value instanceof Color ? value.ios : value; - this.ios.tintColor = color; + if (currentOsVersion < 13) { + this.ios.tintColor = color; + } else { + this.ios.selectedSegmentTintColor = color; + } + } [colorProperty.getDefault](): UIColor {