expo-system-ui 1.0.0 → 1.2.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 +29 -2
- package/README.md +2 -2
- package/android/build.gradle +38 -25
- package/build/ExpoSystemUI.d.ts +1 -0
- package/build/ExpoSystemUI.d.ts.map +1 -0
- package/build/ExpoSystemUI.web.d.ts +1 -0
- package/build/ExpoSystemUI.web.d.ts.map +1 -0
- package/build/SystemUI.d.ts +3 -2
- package/build/SystemUI.d.ts.map +1 -0
- package/build/SystemUI.js +1 -1
- package/build/SystemUI.js.map +1 -1
- package/ios/ExpoSystemUI/ExpoSystemUIModule.swift +40 -10
- package/package.json +8 -6
- package/plugin/build/withAndroidRootViewBackgroundColor.js +4 -4
- package/plugin/build/withAndroidUserInterfaceStyle.js +2 -2
- package/plugin/build/withIosRootViewBackgroundColor.js +2 -2
- package/plugin/build/withIosUserInterfaceStyle.js +1 -1
- package/plugin/build/withSystemUI.js +2 -2
- package/src/SystemUI.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,33 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 1.
|
|
13
|
+
## 1.2.0 — 2022-04-18
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### 💡 Others
|
|
16
|
+
|
|
17
|
+
- Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
|
|
18
|
+
|
|
19
|
+
### ⚠️ Notices
|
|
20
|
+
|
|
21
|
+
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
|
|
22
|
+
|
|
23
|
+
## 1.1.1 - 2022-02-01
|
|
24
|
+
|
|
25
|
+
### 🐛 Bug fixes
|
|
26
|
+
|
|
27
|
+
- Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
|
|
28
|
+
|
|
29
|
+
## 1.1.0 — 2021-12-03
|
|
30
|
+
|
|
31
|
+
### 🛠 Breaking changes
|
|
32
|
+
|
|
33
|
+
- Change iOS to set the background color of the first view controller in the hierarchy instead of the current active view controller. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
|
|
34
|
+
|
|
35
|
+
### 🎉 New features
|
|
36
|
+
|
|
37
|
+
- iOS now sets the background color of the base window to support native-stack modals. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
|
|
38
|
+
- Initial background color on iOS will now be set inside the module instead of in the template. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
|
|
39
|
+
|
|
40
|
+
### 🐛 Bug fixes
|
|
41
|
+
|
|
42
|
+
- Fix `getBackgroundColorAsync` return type. ([#15127](https://github.com/expo/expo/pull/15127) by [@EvanBacon](https://github.com/EvanBacon))
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## API documentation
|
|
6
6
|
|
|
7
|
-
- [Documentation for the
|
|
7
|
+
- [Documentation for the main branch][docs-main]
|
|
8
8
|
- [Documentation for the latest stable release][docs-stable]
|
|
9
9
|
|
|
10
10
|
### Installation
|
|
@@ -21,7 +21,7 @@ For bare React Native projects, ensure that you have the [native `expo` package]
|
|
|
21
21
|
|
|
22
22
|
Contributions are very welcome! Please refer to guidelines described in the [contributing guide][contributing].
|
|
23
23
|
|
|
24
|
-
[docs-main]: https://github.com/expo/expo/blob/
|
|
24
|
+
[docs-main]: https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/system-ui.md
|
|
25
25
|
[docs-stable]: https://docs.expo.dev/versions/latest/sdk/system-ui/
|
|
26
26
|
[contributing]: https://github.com/expo/expo#contributing
|
|
27
27
|
[expo-modules]: https://docs.expo.dev/bare/installing-expo-modules/
|
package/android/build.gradle
CHANGED
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven'
|
|
3
|
+
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '1.
|
|
6
|
+
version = '1.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
|
+
if (expoModulesCorePlugin.exists()) {
|
|
11
|
+
apply from: expoModulesCorePlugin
|
|
12
|
+
applyKotlinExpoModulesCorePlugin()
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
16
|
ext.safeExtGet = { prop, fallback ->
|
|
11
17
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
// Ensures backward compatibility
|
|
21
|
+
ext.getKotlinVersion = {
|
|
22
|
+
if (ext.has("kotlinVersion")) {
|
|
23
|
+
ext.kotlinVersion()
|
|
24
|
+
} else {
|
|
25
|
+
ext.safeExtGet("kotlinVersion", "1.6.10")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
repositories {
|
|
15
30
|
mavenCentral()
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
dependencies {
|
|
19
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${
|
|
34
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
// Upload android library to maven with javadoc and android sources
|
|
24
|
-
configurations {
|
|
25
|
-
deployerJars
|
|
26
|
-
}
|
|
27
|
-
|
|
28
38
|
// Creating sources with comments
|
|
29
39
|
task androidSourcesJar(type: Jar) {
|
|
30
40
|
classifier = 'sources'
|
|
31
41
|
from android.sourceSets.main.java.srcDirs
|
|
32
42
|
}
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
afterEvaluate {
|
|
45
|
+
publishing {
|
|
46
|
+
publications {
|
|
47
|
+
release(MavenPublication) {
|
|
48
|
+
from components.release
|
|
49
|
+
// Add additional sourcesJar to artifacts
|
|
50
|
+
artifact(androidSourcesJar)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
repositories {
|
|
54
|
+
maven {
|
|
55
|
+
url = mavenLocal().url
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
android {
|
|
49
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
50
63
|
|
|
51
64
|
compileOptions {
|
|
52
|
-
sourceCompatibility JavaVersion.
|
|
53
|
-
targetCompatibility JavaVersion.
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
kotlinOptions {
|
|
57
|
-
jvmTarget = JavaVersion.
|
|
70
|
+
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
defaultConfig {
|
|
61
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
62
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
63
76
|
versionCode 1
|
|
64
|
-
versionName '1.
|
|
77
|
+
versionName '1.2.0'
|
|
65
78
|
}
|
|
66
79
|
lintOptions {
|
|
67
80
|
abortOnError false
|
|
@@ -73,7 +86,7 @@ dependencies {
|
|
|
73
86
|
|
|
74
87
|
//noinspection GradleDynamicVersion
|
|
75
88
|
implementation 'com.facebook.react:react-native:+'
|
|
76
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${
|
|
89
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
77
90
|
implementation 'androidx.core:core:1.6.0'
|
|
78
91
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
79
92
|
}
|
package/build/ExpoSystemUI.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoSystemUI.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.ts"],"names":[],"mappings":";AAEA,wBAAqD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoSystemUI.web.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":";;;mCAeiC,MAAM;;AAXvC,wBAgBE"}
|
package/build/SystemUI.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare function setBackgroundColorAsync(color: ColorValue): Promise<void
|
|
|
16
16
|
* ```ts
|
|
17
17
|
* const color = await SystemUI.getBackgroundColorAsync();
|
|
18
18
|
* ```
|
|
19
|
-
* @returns Current root view background color in hex format.
|
|
19
|
+
* @returns Current root view background color in hex format. Returns `null` if the background color is not set.
|
|
20
20
|
*/
|
|
21
|
-
export declare function getBackgroundColorAsync(): Promise<ColorValue>;
|
|
21
|
+
export declare function getBackgroundColorAsync(): Promise<ColorValue | null>;
|
|
22
|
+
//# sourceMappingURL=SystemUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SystemUI.d.ts","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD;;;;;;;;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"}
|
package/build/SystemUI.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function setBackgroundColorAsync(color) {
|
|
|
20
20
|
* ```ts
|
|
21
21
|
* const color = await SystemUI.getBackgroundColorAsync();
|
|
22
22
|
* ```
|
|
23
|
-
* @returns Current root view background color in hex format.
|
|
23
|
+
* @returns Current root view background color in hex format. Returns `null` if the background color is not set.
|
|
24
24
|
*/
|
|
25
25
|
export async function getBackgroundColorAsync() {
|
|
26
26
|
return await ExpoSystemUI.getBackgroundColorAsync();
|
package/build/SystemUI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemUI.js","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAiB;IAC7D,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,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, 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 = 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.\n */\nexport async function getBackgroundColorAsync(): Promise<ColorValue> {\n return await ExpoSystemUI.getBackgroundColorAsync();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SystemUI.js","sourceRoot":"","sources":["../src/SystemUI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAiB;IAC7D,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,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, 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 = 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"]}
|
|
@@ -6,19 +6,49 @@ public class ExpoSystemUIModule: Module {
|
|
|
6
6
|
public func definition() -> ModuleDefinition {
|
|
7
7
|
name("ExpoSystemUI")
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
onCreate {
|
|
10
|
+
// TODO: Maybe read from the app manifest instead of from Info.plist.
|
|
11
|
+
// 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)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function("getBackgroundColorAsync") { () -> String? in
|
|
17
|
+
Self.getBackgroundColor()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function("setBackgroundColorAsync") { (color: Int) in
|
|
21
|
+
Self.setBackgroundColorAsync(color: color)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static func getBackgroundColor() -> String? {
|
|
26
|
+
var color: String?
|
|
27
|
+
EXUtilities.performSynchronously {
|
|
28
|
+
// Get the root view controller of the delegate window.
|
|
29
|
+
if let window = UIApplication.shared.delegate?.window, let backgroundColor = window?.rootViewController?.view.backgroundColor?.cgColor {
|
|
30
|
+
color = EXUtilities.hexString(with: backgroundColor)
|
|
15
31
|
}
|
|
16
|
-
return color
|
|
17
32
|
}
|
|
33
|
+
return color
|
|
34
|
+
}
|
|
18
35
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
36
|
+
static func setBackgroundColorAsync(color: Int?) {
|
|
37
|
+
EXUtilities.performSynchronously {
|
|
38
|
+
if color == nil {
|
|
39
|
+
if let window = UIApplication.shared.delegate?.window {
|
|
40
|
+
window?.backgroundColor = nil
|
|
41
|
+
window?.rootViewController?.view.backgroundColor = UIColor.white
|
|
42
|
+
}
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
let backgroundColor = EXUtilities.uiColor(color)
|
|
46
|
+
// Set the app-wide window, this could have future issues when running multiple React apps,
|
|
47
|
+
// i.e. dev client can't use expo-system-ui.
|
|
48
|
+
// Without setting the window backgroundColor, native-stack modals will show the wrong color.
|
|
49
|
+
if let window = UIApplication.shared.delegate?.window {
|
|
50
|
+
window?.backgroundColor = backgroundColor
|
|
51
|
+
window?.rootViewController?.view.backgroundColor = backgroundColor
|
|
22
52
|
}
|
|
23
53
|
}
|
|
24
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-system-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Interact with system UI elements",
|
|
5
5
|
"main": "build/SystemUI.js",
|
|
6
6
|
"types": "build/SystemUI.d.ts",
|
|
@@ -30,18 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "650 Industries, Inc.",
|
|
32
32
|
"license": "MIT",
|
|
33
|
-
"homepage": "https://docs.expo.
|
|
33
|
+
"homepage": "https://docs.expo.dev/versions/latest/sdk/system-ui",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@expo/config-plugins": "^4.0.
|
|
35
|
+
"@expo/config-plugins": "^4.0.14",
|
|
36
36
|
"@react-native/normalize-color": "^2.0.0",
|
|
37
|
-
"expo-modules-core": "~0.4.2",
|
|
38
37
|
"debug": "^4.3.2"
|
|
39
38
|
},
|
|
40
39
|
"jest": {
|
|
41
|
-
"preset": "expo-module-scripts
|
|
40
|
+
"preset": "expo-module-scripts"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"expo-module-scripts": "^2.0.0"
|
|
45
44
|
},
|
|
46
|
-
"
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"expo": "*"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "22dce752354bb429c84851bc4389abe47a766b1f"
|
|
47
49
|
}
|
|
@@ -7,13 +7,13 @@ const { assignStylesValue, getAppThemeLightNoActionBarGroup } = config_plugins_1
|
|
|
7
7
|
const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
|
|
8
8
|
const WINDOW_BACKGROUND_COLOR = 'activityBackground';
|
|
9
9
|
const withAndroidRootViewBackgroundColor = (config) => {
|
|
10
|
-
config = exports.withRootViewBackgroundColorColors(config);
|
|
11
|
-
config = exports.withRootViewBackgroundColorStyles(config);
|
|
10
|
+
config = (0, exports.withRootViewBackgroundColorColors)(config);
|
|
11
|
+
config = (0, exports.withRootViewBackgroundColorStyles)(config);
|
|
12
12
|
return config;
|
|
13
13
|
};
|
|
14
14
|
exports.withAndroidRootViewBackgroundColor = withAndroidRootViewBackgroundColor;
|
|
15
15
|
const withRootViewBackgroundColorColors = (config) => {
|
|
16
|
-
return config_plugins_1.withAndroidColors(config, async (config) => {
|
|
16
|
+
return (0, config_plugins_1.withAndroidColors)(config, async (config) => {
|
|
17
17
|
config.modResults = assignColorValue(config.modResults, {
|
|
18
18
|
value: getRootViewBackgroundColor(config),
|
|
19
19
|
name: WINDOW_BACKGROUND_COLOR,
|
|
@@ -23,7 +23,7 @@ const withRootViewBackgroundColorColors = (config) => {
|
|
|
23
23
|
};
|
|
24
24
|
exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
|
|
25
25
|
const withRootViewBackgroundColorStyles = (config) => {
|
|
26
|
-
return config_plugins_1.withAndroidStyles(config, async (config) => {
|
|
26
|
+
return (0, config_plugins_1.withAndroidStyles)(config, async (config) => {
|
|
27
27
|
config.modResults = assignStylesValue(config.modResults, {
|
|
28
28
|
add: !!getRootViewBackgroundColor(config),
|
|
29
29
|
parent: getAppThemeLightNoActionBarGroup(),
|
|
@@ -9,7 +9,7 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
9
9
|
// strings.xml keys, this should not change.
|
|
10
10
|
const USER_INTERFACE_STYLE_KEY = 'expo_system_ui_user_interface_style';
|
|
11
11
|
const withAndroidUserInterfaceStyle = (config) => {
|
|
12
|
-
return config_plugins_1.withStringsXml(config, (config) => {
|
|
12
|
+
return (0, config_plugins_1.withStringsXml)(config, (config) => {
|
|
13
13
|
config.modResults = setStrings(config.modResults, resolveProps(config));
|
|
14
14
|
return config;
|
|
15
15
|
});
|
|
@@ -18,7 +18,7 @@ exports.withAndroidUserInterfaceStyle = withAndroidUserInterfaceStyle;
|
|
|
18
18
|
function resolveProps(config) {
|
|
19
19
|
var _a, _b;
|
|
20
20
|
const userInterfaceStyle = (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.userInterfaceStyle) !== null && _b !== void 0 ? _b : config.userInterfaceStyle;
|
|
21
|
-
assert_1.default(!userInterfaceStyle || ['automatic', 'light', 'dark'].includes(userInterfaceStyle), `expo-system-ui: Invalid userInterfaceStyle: "${userInterfaceStyle}"`);
|
|
21
|
+
(0, assert_1.default)(!userInterfaceStyle || ['automatic', 'light', 'dark'].includes(userInterfaceStyle), `expo-system-ui: Invalid userInterfaceStyle: "${userInterfaceStyle}"`);
|
|
22
22
|
return { userInterfaceStyle };
|
|
23
23
|
}
|
|
24
24
|
exports.resolveProps = resolveProps;
|
|
@@ -11,7 +11,7 @@ const normalize_color_1 = __importDefault(require("@react-native/normalize-color
|
|
|
11
11
|
const BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';
|
|
12
12
|
const debug = require('debug')('expo:system-ui:plugin:ios');
|
|
13
13
|
const withIosRootViewBackgroundColor = (config) => {
|
|
14
|
-
config = config_plugins_1.withInfoPlist(config, (config) => {
|
|
14
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
15
15
|
config.modResults = setRootViewBackgroundColor(config, config.modResults);
|
|
16
16
|
return config;
|
|
17
17
|
});
|
|
@@ -24,7 +24,7 @@ function setRootViewBackgroundColor(config, infoPlist) {
|
|
|
24
24
|
delete infoPlist[BACKGROUND_COLOR_KEY];
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
let color = normalize_color_1.default(backgroundColor);
|
|
27
|
+
let color = (0, normalize_color_1.default)(backgroundColor);
|
|
28
28
|
if (!color) {
|
|
29
29
|
throw new Error('Invalid background color on iOS');
|
|
30
30
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setUserInterfaceStyle = exports.getUserInterfaceStyle = exports.withIosUserInterfaceStyle = void 0;
|
|
4
4
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
5
|
const withIosUserInterfaceStyle = (config) => {
|
|
6
|
-
return config_plugins_1.withInfoPlist(config, (config) => {
|
|
6
|
+
return (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
7
7
|
config.modResults = setUserInterfaceStyle(config, config.modResults);
|
|
8
8
|
return config;
|
|
9
9
|
});
|
|
@@ -7,11 +7,11 @@ const withIosRootViewBackgroundColor_1 = require("./withIosRootViewBackgroundCol
|
|
|
7
7
|
const withIosUserInterfaceStyle_1 = require("./withIosUserInterfaceStyle");
|
|
8
8
|
const pkg = require('expo-system-ui/package.json');
|
|
9
9
|
const withSystemUI = (config) => {
|
|
10
|
-
return config_plugins_1.withPlugins(config, [
|
|
10
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
11
11
|
withAndroidRootViewBackgroundColor_1.withAndroidRootViewBackgroundColor,
|
|
12
12
|
withIosRootViewBackgroundColor_1.withIosRootViewBackgroundColor,
|
|
13
13
|
withAndroidUserInterfaceStyle_1.withAndroidUserInterfaceStyle,
|
|
14
14
|
withIosUserInterfaceStyle_1.withIosUserInterfaceStyle,
|
|
15
15
|
]);
|
|
16
16
|
};
|
|
17
|
-
exports.default = config_plugins_1.createRunOncePlugin(withSystemUI, pkg.name, pkg.version);
|
|
17
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withSystemUI, pkg.name, pkg.version);
|
package/src/SystemUI.ts
CHANGED
|
@@ -23,8 +23,8 @@ export async function setBackgroundColorAsync(color: ColorValue): Promise<void>
|
|
|
23
23
|
* ```ts
|
|
24
24
|
* const color = await SystemUI.getBackgroundColorAsync();
|
|
25
25
|
* ```
|
|
26
|
-
* @returns Current root view background color in hex format.
|
|
26
|
+
* @returns Current root view background color in hex format. Returns `null` if the background color is not set.
|
|
27
27
|
*/
|
|
28
|
-
export async function getBackgroundColorAsync(): Promise<ColorValue> {
|
|
28
|
+
export async function getBackgroundColorAsync(): Promise<ColorValue | null> {
|
|
29
29
|
return await ExpoSystemUI.getBackgroundColorAsync();
|
|
30
30
|
}
|