@onekeyfe/react-native-device-utils 6.7.0-alpha.342 → 6.7.0-alpha.343

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.
@@ -8,6 +8,7 @@ import android.graphics.drawable.GradientDrawable
8
8
  import android.graphics.Rect
9
9
  import android.os.Build
10
10
  import android.view.Gravity
11
+ import android.view.WindowInsetsController
11
12
  import android.view.View
12
13
  import android.view.ViewGroup
13
14
  import android.widget.FrameLayout
@@ -910,8 +911,18 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
910
911
  val window = activity.window
911
912
  val decorView = window.decorView
912
913
 
913
- WindowCompat.getInsetsController(window, decorView)
914
- .isAppearanceLightNavigationBars = appearance.useDarkIcons
914
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
915
+ // WindowInsetsControllerCompat leaves the previous value in place on
916
+ // Android 11-14 once the window is appearance-controlled, so runtime
917
+ // theme switches kept stale button colors. Use the platform API.
918
+ window.insetsController?.setSystemBarsAppearance(
919
+ if (appearance.useDarkIcons) WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS else 0,
920
+ WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
921
+ )
922
+ } else {
923
+ WindowCompat.getInsetsController(window, decorView)
924
+ .isAppearanceLightNavigationBars = appearance.useDarkIcons
925
+ }
915
926
 
916
927
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
917
928
  window.isNavigationBarContrastEnforced = false
@@ -989,8 +1000,8 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
989
1000
  )
990
1001
  else -> Triple(0, 0, Gravity.BOTTOM)
991
1002
  }
992
- // Fade in from the content edge so the protection never draws a hard line
993
- // against the page; the solid half keeps the buttons legible.
1003
+ // Fade in over the first third from the content edge so the protection never
1004
+ // draws a hard line against the page; the buttons sit on the solid rest.
994
1005
  val fadeOrientation = when (gravity) {
995
1006
  Gravity.LEFT -> GradientDrawable.Orientation.RIGHT_LEFT
996
1007
  Gravity.RIGHT -> GradientDrawable.Orientation.LEFT_RIGHT
@@ -998,7 +1009,7 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
998
1009
  }
999
1010
  view.background = GradientDrawable(
1000
1011
  fadeOrientation,
1001
- intArrayOf(color and 0x00FFFFFF, color, color),
1012
+ intArrayOf(color and 0x00FFFFFF, color, color, color),
1002
1013
  )
1003
1014
  if (
1004
1015
  layoutParams.width != width ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-device-utils",
3
- "version": "6.7.0-alpha.342",
3
+ "version": "6.7.0-alpha.343",
4
4
  "description": "Native device, launch, system appearance and boot recovery utilities for OneKey",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",