Skip to content

Commit ca7c46d

Browse files
tsonevnmanoldonev
authored andcommitted
feat(segmented-bar-ios): add support for the new selectedSegmentTintColor property (#7880)
1 parent d479067 commit ca7c46d

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎tns-core-modules/ui/segmented-bar/segmented-bar.ios.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
SegmentedBarItemBase, SegmentedBarBase, selectedIndexProperty, itemsProperty, selectedBackgroundColorProperty,
44
colorProperty, fontInternalProperty, Color
55
} from "./segmented-bar-common";
6-
6+
import { ios as iosUtils } from "../../utils/utils";
77
export * from "./segmented-bar-common";
88

99
export class SegmentedBarItem extends SegmentedBarItemBase {
@@ -68,11 +68,19 @@ export class SegmentedBar extends SegmentedBarBase {
6868
}
6969

7070
[selectedBackgroundColorProperty.getDefault](): UIColor {
71-
return this.ios.tintColor;
71+
const currentOsVersion = iosUtils.MajorVersion;
72+
73+
return currentOsVersion < 13 ? this.ios.tintColor : this.ios.selectedSegmentTintColor;
7274
}
7375
[selectedBackgroundColorProperty.setNative](value: UIColor | Color) {
76+
const currentOsVersion = iosUtils.MajorVersion;
7477
let color = value instanceof Color ? value.ios : value;
75-
this.ios.tintColor = color;
78+
if (currentOsVersion < 13) {
79+
this.ios.tintColor = color;
80+
} else {
81+
this.ios.selectedSegmentTintColor = color;
82+
}
83+
7684
}
7785

7886
[colorProperty.getDefault](): UIColor {

0 commit comments

Comments
 (0)