mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(ios): actionBar title to use appearance api on ios15+ (#9534)
https://github.com/NativeScript/NativeScript/pull/9530
This commit is contained in:
@ -357,6 +357,11 @@ export class ActionBar extends ActionBarBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (color) {
|
if (color) {
|
||||||
|
if (majorVersion >= 15) {
|
||||||
|
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new();
|
||||||
|
appearance.titleTextAttributes = NSDictionary.dictionaryWithObjectForKey(color.ios, NSForegroundColorAttributeName);
|
||||||
|
} else {
|
||||||
|
// legacy styling
|
||||||
navBar.titleTextAttributes = <any>{
|
navBar.titleTextAttributes = <any>{
|
||||||
[NSForegroundColorAttributeName]: color.ios,
|
[NSForegroundColorAttributeName]: color.ios,
|
||||||
};
|
};
|
||||||
@ -364,6 +369,7 @@ export class ActionBar extends ActionBarBase {
|
|||||||
[NSForegroundColorAttributeName]: color.ios,
|
[NSForegroundColorAttributeName]: color.ios,
|
||||||
};
|
};
|
||||||
navBar.tintColor = color.ios;
|
navBar.tintColor = color.ios;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
navBar.titleTextAttributes = null;
|
navBar.titleTextAttributes = null;
|
||||||
navBar.largeTitleTextAttributes = null;
|
navBar.largeTitleTextAttributes = null;
|
||||||
@ -377,7 +383,7 @@ export class ActionBar extends ActionBarBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const color_ = color instanceof Color ? color.ios : color;
|
const color_ = color instanceof Color ? color.ios : color;
|
||||||
if (majorVersion >= 13) {
|
if (majorVersion >= 15) {
|
||||||
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new();
|
const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new();
|
||||||
// appearance.configureWithOpaqueBackground();
|
// appearance.configureWithOpaqueBackground();
|
||||||
appearance.backgroundColor = color_;
|
appearance.backgroundColor = color_;
|
||||||
|
Reference in New Issue
Block a user