expo-system-ui 2.3.0 → 2.4.0

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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.4.0 — 2023-06-21
14
+
15
+ ### 🎉 New features
16
+
17
+ - Persist user selected background color and restore automatically on iOS. Added `restoreBackgroundColorAsync` to restore it on Android. ([#22773](https://github.com/expo/expo/pull/22773) by [@alanhughes](https://github.com/alanjhughes))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
22
+
13
23
  ## 2.3.0 — 2023-05-08
14
24
 
15
25
  ### 💡 Others
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '2.3.0'
6
+ version = '2.4.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -35,19 +35,11 @@ buildscript {
35
35
  }
36
36
  }
37
37
 
38
- // Creating sources with comments
39
- task androidSourcesJar(type: Jar) {
40
- classifier = 'sources'
41
- from android.sourceSets.main.java.srcDirs
42
- }
43
-
44
38
  afterEvaluate {
45
39
  publishing {
46
40
  publications {
47
41
  release(MavenPublication) {
48
42
  from components.release
49
- // Add additional sourcesJar to artifacts
50
- artifact(androidSourcesJar)
51
43
  }
52
44
  }
53
45
  repositories {
@@ -70,15 +62,21 @@ android {
70
62
  jvmTarget = JavaVersion.VERSION_11.majorVersion
71
63
  }
72
64
 
65
+ namespace "expo.modules.systemui"
73
66
  defaultConfig {
74
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
69
  versionCode 1
77
- versionName '2.3.0'
70
+ versionName '2.4.0'
78
71
  }
79
72
  lintOptions {
80
73
  abortOnError false
81
74
  }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
82
80
  }
83
81
 
84
82
  dependencies {
@@ -1,2 +1,2 @@
1
- <manifest package="expo.modules.systemui">
1
+ <manifest>
2
2
  </manifest>
@@ -1,23 +1,53 @@
1
1
  package expo.modules.systemui
2
2
 
3
+ import android.content.Context
4
+ import android.content.SharedPreferences
5
+ import android.content.res.Configuration
3
6
  import android.graphics.Color
4
7
  import android.graphics.drawable.ColorDrawable
8
+ import androidx.appcompat.app.AppCompatDelegate
5
9
  import expo.modules.kotlin.exception.Exceptions
6
10
  import expo.modules.kotlin.functions.Queues
7
11
  import expo.modules.kotlin.modules.Module
8
12
  import expo.modules.kotlin.modules.ModuleDefinition
9
13
 
14
+ const val PREFERENCE_KEY = "expoRootBackgroundColor"
15
+
10
16
  class SystemUIModule : Module() {
11
17
  private val currentActivity
12
18
  get() = appContext.currentActivity ?: throw Exceptions.MissingActivity()
19
+ private val context: Context
20
+ get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
21
+ private val prefs: SharedPreferences
22
+ get() = context.getSharedPreferences("expo_ui_preferences", Context.MODE_PRIVATE)
23
+ ?: throw Exceptions.ReactContextLost()
24
+
25
+ private val systemBackgroundColor
26
+ get() = when (AppCompatDelegate.getDefaultNightMode()) {
27
+ AppCompatDelegate.MODE_NIGHT_YES -> Color.BLACK
28
+ AppCompatDelegate.MODE_NIGHT_NO -> Color.WHITE
29
+ AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM -> {
30
+ when (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
31
+ Configuration.UI_MODE_NIGHT_YES -> Color.BLACK
32
+ Configuration.UI_MODE_NIGHT_NO -> Color.WHITE
33
+ else -> Color.WHITE
34
+ }
35
+ }
36
+ else -> Color.WHITE
37
+ }
13
38
 
14
39
  override fun definition() = ModuleDefinition {
15
40
  Name("ExpoSystemUI")
16
41
 
17
- AsyncFunction("setBackgroundColorAsync") { color: Int ->
18
- val rootView = currentActivity.window.decorView
19
- val colorInt = Color.parseColor(colorToHex(color))
20
- rootView.setBackgroundColor(colorInt)
42
+ AsyncFunction("setBackgroundColorAsync") { color: Int? ->
43
+ color?.let {
44
+ prefs.edit()
45
+ .putInt(PREFERENCE_KEY, it)
46
+ .apply()
47
+ } ?: prefs.edit()
48
+ .remove(PREFERENCE_KEY)
49
+ .apply()
50
+ setBackgroundColor(color ?: systemBackgroundColor)
21
51
  }.runOnQueue(Queues.MAIN)
22
52
 
23
53
  AsyncFunction("getBackgroundColorAsync") {
@@ -30,6 +60,12 @@ class SystemUIModule : Module() {
30
60
  }
31
61
  }
32
62
 
63
+ private fun setBackgroundColor(color: Int) {
64
+ val rootView = currentActivity.window?.decorView
65
+ val colorInt = Color.parseColor(colorToHex(color))
66
+ rootView?.setBackgroundColor(colorInt)
67
+ }
68
+
33
69
  companion object {
34
70
  fun colorToHex(color: Int): String {
35
71
  return String.format("#%02x%02x%02x", Color.red(color), Color.green(color), Color.blue(color))
@@ -7,14 +7,14 @@ import androidx.appcompat.app.AppCompatDelegate
7
7
  object SystemUI {
8
8
  private const val TAG = "SystemUI"
9
9
 
10
- fun setUserInterfaceStyle(
11
- style: String,
10
+ private fun setUserInterfaceStyle(
11
+ style: String?,
12
12
  successCallback: () -> Unit,
13
13
  failureCallback: (reason: String) -> Unit
14
14
  ) {
15
15
 
16
16
  val mode = if (style == null) {
17
- AppCompatDelegate.MODE_NIGHT_NO
17
+ AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
18
18
  } else when (style) {
19
19
  "automatic" -> {
20
20
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
@@ -1,7 +1,7 @@
1
1
  declare const _default: {
2
2
  readonly name: string;
3
3
  getBackgroundColorAsync(): any;
4
- setBackgroundColorAsync(color: string): void;
4
+ setBackgroundColorAsync(color: string | null): void;
5
5
  };
6
6
  export default _default;
7
7
  //# sourceMappingURL=ExpoSystemUI.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSystemUI.web.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":";;;mCAeiC,MAAM;;AAXvC,wBAgBE"}
1
+ {"version":3,"file":"ExpoSystemUI.web.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":";;;mCAeiC,MAAM,GAAG,IAAI;;AAX9C,wBAgBE"}
@@ -15,7 +15,7 @@ export default {
15
15
  },
16
16
  setBackgroundColorAsync(color) {
17
17
  if (Platform.isDOMAvailable) {
18
- document.body.style.backgroundColor = color;
18
+ document.body.style.backgroundColor = color ?? 'white';
19
19
  }
20
20
  },
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSystemUI.web.js","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,sBAAsB;AACtB,OAAO,cAAc,MAAM,kDAAkD,CAAC;AAE9E,eAAe;IACb,IAAI,IAAI;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,uBAAuB;QACrB,IAAI,QAAQ,CAAC,cAAc,EAAE;YAC3B,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;SAC5D;aAAM;YACL,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IACD,uBAAuB,CAAC,KAAa;QACnC,IAAI,QAAQ,CAAC,cAAc,EAAE;YAC3B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC;SAC7C;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n// @ts-ignore: untyped\nimport normalizeColor from 'react-native-web/dist/cjs/modules/normalizeColor';\n\nexport default {\n get name(): string {\n return 'ExpoSystemUI';\n },\n getBackgroundColorAsync() {\n if (Platform.isDOMAvailable) {\n return normalizeColor(document.body.style.backgroundColor);\n } else {\n return null;\n }\n },\n setBackgroundColorAsync(color: string) {\n if (Platform.isDOMAvailable) {\n document.body.style.backgroundColor = color;\n }\n },\n};\n"]}
1
+ {"version":3,"file":"ExpoSystemUI.web.js","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,sBAAsB;AACtB,OAAO,cAAc,MAAM,kDAAkD,CAAC;AAE9E,eAAe;IACb,IAAI,IAAI;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,uBAAuB;QACrB,IAAI,QAAQ,CAAC,cAAc,EAAE;YAC3B,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;SAC5D;aAAM;YACL,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IACD,uBAAuB,CAAC,KAAoB;QAC1C,IAAI,QAAQ,CAAC,cAAc,EAAE;YAC3B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,KAAK,IAAI,OAAO,CAAC;SACxD;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n// @ts-ignore: untyped\nimport normalizeColor from 'react-native-web/dist/cjs/modules/normalizeColor';\n\nexport default {\n get name(): string {\n return 'ExpoSystemUI';\n },\n getBackgroundColorAsync() {\n if (Platform.isDOMAvailable) {\n return normalizeColor(document.body.style.backgroundColor);\n } else {\n return null;\n }\n },\n setBackgroundColorAsync(color: string | null) {\n if (Platform.isDOMAvailable) {\n document.body.style.backgroundColor = color ?? 'white';\n }\n },\n};\n"]}
@@ -1,14 +1,15 @@
1
1
  import { ColorValue } from 'react-native';
2
2
  /**
3
3
  * Changes the root view background color.
4
+ * Call this function in the root file outside of you component.
4
5
  *
5
6
  * @example
6
7
  * ```ts
7
- * SystemUI.setBackgroundColorAsync("white");
8
+ * SystemUI.setBackgroundColorAsync("black");
8
9
  * ```
9
10
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
10
11
  */
11
- export declare function setBackgroundColorAsync(color: ColorValue): Promise<void>;
12
+ export declare function setBackgroundColorAsync(color: ColorValue | null): Promise<void>;
12
13
  /**
13
14
  * Gets the root view background color.
14
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"SystemUI.d.ts","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAC;AAIlE;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAE1E"}
1
+ {"version":3,"file":"SystemUI.d.ts","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAC;AAIlE;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrF;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAE1E"}
package/build/SystemUI.js CHANGED
@@ -2,16 +2,22 @@ import { Platform, processColor } from 'react-native';
2
2
  import ExpoSystemUI from './ExpoSystemUI';
3
3
  /**
4
4
  * Changes the root view background color.
5
+ * Call this function in the root file outside of you component.
5
6
  *
6
7
  * @example
7
8
  * ```ts
8
- * SystemUI.setBackgroundColorAsync("white");
9
+ * SystemUI.setBackgroundColorAsync("black");
9
10
  * ```
10
11
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
11
12
  */
12
13
  export async function setBackgroundColorAsync(color) {
13
- const colorNumber = Platform.OS === 'web' ? color : processColor(color);
14
- return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
14
+ if (color == null) {
15
+ return await ExpoSystemUI.setBackgroundColorAsync(null);
16
+ }
17
+ else {
18
+ const colorNumber = Platform.OS === 'web' ? color : processColor(color);
19
+ return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
20
+ }
15
21
  }
16
22
  /**
17
23
  * Gets the root view background color.
@@ -1 +1 @@
1
- {"version":3,"file":"SystemUI.js","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAiB;IAC7D,MAAM,WAAW,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACxE,OAAO,MAAM,YAAY,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,OAAO,MAAM,YAAY,CAAC,uBAAuB,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { ColorValue, Platform, processColor } from 'react-native';\n\nimport ExpoSystemUI from './ExpoSystemUI';\n\n/**\n * Changes the root view background color.\n *\n * @example\n * ```ts\n * SystemUI.setBackgroundColorAsync(\"white\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBackgroundColorAsync(color: ColorValue): Promise<void> {\n const colorNumber = Platform.OS === 'web' ? color : processColor(color);\n return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);\n}\n\n/**\n * Gets the root view background color.\n *\n * @example\n * ```ts\n * const color = await SystemUI.getBackgroundColorAsync();\n * ```\n * @returns Current root view background color in hex format. Returns `null` if the background color is not set.\n */\nexport async function getBackgroundColorAsync(): Promise<ColorValue | null> {\n return await ExpoSystemUI.getBackgroundColorAsync();\n}\n"]}
1
+ {"version":3,"file":"SystemUI.js","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAwB;IACpE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,MAAM,YAAY,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;KACzD;SAAM;QACL,MAAM,WAAW,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACxE,OAAO,MAAM,YAAY,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;KAChE;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,OAAO,MAAM,YAAY,CAAC,uBAAuB,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { ColorValue, Platform, processColor } from 'react-native';\n\nimport ExpoSystemUI from './ExpoSystemUI';\n\n/**\n * Changes the root view background color.\n * Call this function in the root file outside of you component.\n *\n * @example\n * ```ts\n * SystemUI.setBackgroundColorAsync(\"black\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBackgroundColorAsync(color: ColorValue | null): Promise<void> {\n if (color == null) {\n return await ExpoSystemUI.setBackgroundColorAsync(null);\n } else {\n const colorNumber = Platform.OS === 'web' ? color : processColor(color);\n return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);\n }\n}\n\n/**\n * Gets the root view background color.\n *\n * @example\n * ```ts\n * const color = await SystemUI.getBackgroundColorAsync();\n * ```\n * @returns Current root view background color in hex format. Returns `null` if the background color is not set.\n */\nexport async function getBackgroundColorAsync(): Promise<ColorValue | null> {\n return await ExpoSystemUI.getBackgroundColorAsync();\n}\n"]}
@@ -3,21 +3,27 @@
3
3
  import ExpoModulesCore
4
4
 
5
5
  public class ExpoSystemUIModule: Module {
6
+ private static let colorKey = "ExpoSystemUI.backgroundColor"
6
7
  public func definition() -> ModuleDefinition {
7
8
  Name("ExpoSystemUI")
8
9
 
9
10
  OnCreate {
10
11
  // TODO: Maybe read from the app manifest instead of from Info.plist.
11
12
  // Set / reset the initial color on reload and app start.
12
- let color = Bundle.main.object(forInfoDictionaryKey: "RCTRootViewBackgroundColor") as? Int
13
- Self.setBackgroundColorAsync(color: color)
13
+ let color = UserDefaults.standard.integer(forKey: Self.colorKey)
14
+
15
+ if color > 0 {
16
+ Self.setBackgroundColorAsync(color: color)
17
+ } else {
18
+ Self.setBackgroundColorAsync(color: nil)
19
+ }
14
20
  }
15
21
 
16
22
  AsyncFunction("getBackgroundColorAsync") { () -> String? in
17
23
  Self.getBackgroundColor()
18
24
  }
19
25
 
20
- AsyncFunction("setBackgroundColorAsync") { (color: Int) in
26
+ AsyncFunction("setBackgroundColorAsync") { (color: Int?) in
21
27
  Self.setBackgroundColorAsync(color: color)
22
28
  }
23
29
  }
@@ -37,11 +43,22 @@ public class ExpoSystemUIModule: Module {
37
43
  EXUtilities.performSynchronously {
38
44
  if color == nil {
39
45
  if let window = UIApplication.shared.delegate?.window {
46
+ UserDefaults.standard.removeObject(forKey: colorKey)
47
+ let interfaceStyle = window?.traitCollection.userInterfaceStyle
40
48
  window?.backgroundColor = nil
41
- window?.rootViewController?.view.backgroundColor = UIColor.white
49
+
50
+ switch interfaceStyle {
51
+ case .dark:
52
+ window?.rootViewController?.view.backgroundColor = .black
53
+ case .light:
54
+ window?.rootViewController?.view.backgroundColor = .white
55
+ default:
56
+ window?.rootViewController?.view.backgroundColor = .white
57
+ }
42
58
  }
43
59
  return
44
60
  }
61
+ UserDefaults.standard.set(color, forKey: colorKey)
45
62
  let backgroundColor = EXUtilities.uiColor(color)
46
63
  // Set the app-wide window, this could have future issues when running multiple React apps,
47
64
  // i.e. dev client can't use expo-system-ui.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-system-ui",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Interact with system UI elements",
5
5
  "main": "build/SystemUI.js",
6
6
  "types": "build/SystemUI.d.ts",
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
47
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
48
48
  }
@@ -13,9 +13,9 @@ export default {
13
13
  return null;
14
14
  }
15
15
  },
16
- setBackgroundColorAsync(color: string) {
16
+ setBackgroundColorAsync(color: string | null) {
17
17
  if (Platform.isDOMAvailable) {
18
- document.body.style.backgroundColor = color;
18
+ document.body.style.backgroundColor = color ?? 'white';
19
19
  }
20
20
  },
21
21
  };
package/src/SystemUI.ts CHANGED
@@ -4,16 +4,21 @@ import ExpoSystemUI from './ExpoSystemUI';
4
4
 
5
5
  /**
6
6
  * Changes the root view background color.
7
+ * Call this function in the root file outside of you component.
7
8
  *
8
9
  * @example
9
10
  * ```ts
10
- * SystemUI.setBackgroundColorAsync("white");
11
+ * SystemUI.setBackgroundColorAsync("black");
11
12
  * ```
12
13
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
13
14
  */
14
- export async function setBackgroundColorAsync(color: ColorValue): Promise<void> {
15
- const colorNumber = Platform.OS === 'web' ? color : processColor(color);
16
- return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
15
+ export async function setBackgroundColorAsync(color: ColorValue | null): Promise<void> {
16
+ if (color == null) {
17
+ return await ExpoSystemUI.setBackgroundColorAsync(null);
18
+ } else {
19
+ const colorNumber = Platform.OS === 'web' ? color : processColor(color);
20
+ return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
21
+ }
17
22
  }
18
23
 
19
24
  /**