craft-native 0.0.475 → 0.0.476
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -867,6 +867,7 @@ internal class CraftNativeChrome(
|
|
|
867
867
|
private var renderedButtonSpecs: Pair<String, String>? = null
|
|
868
868
|
private val density = resources.displayMetrics.density
|
|
869
869
|
private var screenBackgroundColor: Int? = null
|
|
870
|
+
private var navigationTitleColor: Int? = null
|
|
870
871
|
private var selectedTab = 0
|
|
871
872
|
private var tabBarHiddenByScreen = false
|
|
872
873
|
private var visiblePath: String? = null
|
|
@@ -1049,6 +1050,10 @@ internal class CraftNativeChrome(
|
|
|
1049
1050
|
?.takeUnless { it == JSONObject.NULL }
|
|
1050
1051
|
?.let { craftNativeOptionalString(it) }
|
|
1051
1052
|
?.let { runCatching { craftNativeColor(it) }.getOrNull() }
|
|
1053
|
+
navigationTitleColor = options.opt("titleColor")
|
|
1054
|
+
?.takeUnless { it == JSONObject.NULL }
|
|
1055
|
+
?.let { craftNativeOptionalString(it) }
|
|
1056
|
+
?.let { runCatching { craftNativeColor(it) }.getOrNull() }
|
|
1052
1057
|
options.optJSONObject("tabItem")?.let(::updateTab)
|
|
1053
1058
|
val hidden = options.optBoolean("hidden", false)
|
|
1054
1059
|
val large = options.optBoolean("largeTitle", false) && depth == 0
|
|
@@ -1214,8 +1219,8 @@ internal class CraftNativeChrome(
|
|
|
1214
1219
|
setBackgroundColor(background)
|
|
1215
1220
|
bar.setBackgroundColor(background)
|
|
1216
1221
|
largeTitleView.setBackgroundColor(background)
|
|
1217
|
-
titleView.setTextColor(text)
|
|
1218
|
-
largeTitleView.setTextColor(text)
|
|
1222
|
+
titleView.setTextColor(navigationTitleColor ?: text)
|
|
1223
|
+
largeTitleView.setTextColor(navigationTitleColor ?: text)
|
|
1219
1224
|
backButton.imageTintList = ColorStateList.valueOf(accent)
|
|
1220
1225
|
val surface = if (dark) Color.parseColor("#1C1C1E") else Color.parseColor("#F9F9F9")
|
|
1221
1226
|
tabBar.background = GradientDrawable().apply { setColor(surface); cornerRadius = dp(32).toFloat() }
|
package/dist/cli.js
CHANGED
|
@@ -3243,7 +3243,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3243
3243
|
`);
|
|
3244
3244
|
}
|
|
3245
3245
|
// package.json
|
|
3246
|
-
var version = "0.0.
|
|
3246
|
+
var version = "0.0.476";
|
|
3247
3247
|
|
|
3248
3248
|
// bin/cli.ts
|
|
3249
3249
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -7856,6 +7856,8 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
7856
7856
|
/// the home indicator too, where its content never reaches: a black
|
|
7857
7857
|
/// full-screen timer is black edge to edge. nil is the app's.
|
|
7858
7858
|
private var screenBackgroundColor: UIColor?
|
|
7859
|
+
/// Title contrast belongs to this screen, independently of the bar material.
|
|
7860
|
+
private var navigationTitleColor: UIColor?
|
|
7859
7861
|
|
|
7860
7862
|
override var preferredStatusBarStyle: UIStatusBarStyle {
|
|
7861
7863
|
statusBarStyleOverride ?? .default
|
|
@@ -7926,6 +7928,9 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
7926
7928
|
if let solid = options["navigationBarSolid"] as? Bool {
|
|
7927
7929
|
navigationBarSolid = solid
|
|
7928
7930
|
}
|
|
7931
|
+
if options.keys.contains("titleColor") {
|
|
7932
|
+
navigationTitleColor = color(options["titleColor"])
|
|
7933
|
+
}
|
|
7929
7934
|
if let hidden = options["hidden"] as? Bool {
|
|
7930
7935
|
navigationBarHidden = hidden
|
|
7931
7936
|
if navigationController?.topViewController === self {
|
|
@@ -7941,7 +7946,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
7941
7946
|
let buttons = (options["rightButtons"] as? [[String: Any]]) ?? []
|
|
7942
7947
|
navigationItem.rightBarButtonItems = buttons.compactMap(navigationButton).reversed()
|
|
7943
7948
|
}
|
|
7944
|
-
if options.keys.contains("backgroundColor") || options.keys.contains("navigationBarSolid") {
|
|
7949
|
+
if options.keys.contains("backgroundColor") || options.keys.contains("navigationBarSolid") || options.keys.contains("titleColor") {
|
|
7945
7950
|
applyNavigationBarAppearance()
|
|
7946
7951
|
trackContentScrollView()
|
|
7947
7952
|
}
|
|
@@ -7952,25 +7957,44 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
7952
7957
|
}
|
|
7953
7958
|
}
|
|
7954
7959
|
|
|
7955
|
-
///
|
|
7956
|
-
///
|
|
7960
|
+
/// Per-item appearances preserve each UIKit bar state and never recolour a
|
|
7961
|
+
/// sibling controller's title or opt a material bar into an opaque fill.
|
|
7957
7962
|
private func applyNavigationBarAppearance() {
|
|
7958
|
-
guard navigationBarSolid else {
|
|
7963
|
+
guard navigationBarSolid || navigationTitleColor != nil else {
|
|
7959
7964
|
navigationItem.standardAppearance = nil
|
|
7960
7965
|
navigationItem.scrollEdgeAppearance = nil
|
|
7961
7966
|
navigationItem.compactAppearance = nil
|
|
7962
7967
|
navigationItem.compactScrollEdgeAppearance = nil
|
|
7963
7968
|
return
|
|
7964
7969
|
}
|
|
7965
|
-
let
|
|
7966
|
-
|
|
7967
|
-
appearance
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7970
|
+
let bar = navigationController?.navigationBar
|
|
7971
|
+
let standard = bar?.standardAppearance ?? UINavigationBarAppearance()
|
|
7972
|
+
// UIKit's unspecified scroll-edge appearance uses a transparent
|
|
7973
|
+
// background. Copy its standard text/button attributes before applying
|
|
7974
|
+
// that background so adding title contrast preserves the same states.
|
|
7975
|
+
let scrollEdge = bar?.scrollEdgeAppearance ?? {
|
|
7976
|
+
let appearance = UINavigationBarAppearance(barAppearance: standard)
|
|
7977
|
+
appearance.configureWithTransparentBackground()
|
|
7978
|
+
return appearance
|
|
7979
|
+
}()
|
|
7980
|
+
func styled(_ base: UINavigationBarAppearance) -> UINavigationBarAppearance {
|
|
7981
|
+
let appearance = UINavigationBarAppearance(barAppearance: base)
|
|
7982
|
+
if navigationBarSolid {
|
|
7983
|
+
appearance.configureWithOpaqueBackground()
|
|
7984
|
+
appearance.backgroundColor = screenBackgroundColor ?? config.resolvedBackgroundColor
|
|
7985
|
+
appearance.shadowColor = .clear
|
|
7986
|
+
}
|
|
7987
|
+
CraftChromeFonts.apply(to: appearance)
|
|
7988
|
+
if let navigationTitleColor {
|
|
7989
|
+
appearance.titleTextAttributes[.foregroundColor] = navigationTitleColor
|
|
7990
|
+
appearance.largeTitleTextAttributes[.foregroundColor] = navigationTitleColor
|
|
7991
|
+
}
|
|
7992
|
+
return appearance
|
|
7993
|
+
}
|
|
7994
|
+
navigationItem.standardAppearance = styled(standard)
|
|
7995
|
+
navigationItem.scrollEdgeAppearance = styled(scrollEdge)
|
|
7996
|
+
navigationItem.compactAppearance = styled(bar?.compactAppearance ?? standard)
|
|
7997
|
+
navigationItem.compactScrollEdgeAppearance = styled(bar?.compactScrollEdgeAppearance ?? scrollEdge)
|
|
7974
7998
|
}
|
|
7975
7999
|
|
|
7976
8000
|
private func applyStatusBar(_ props: [String: Any]) {
|