expo-system-ui 1.1.0 → 1.3.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,32 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 1.3.0 — 2022-07-07
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix color setting on web. ([#17558](https://github.com/expo/expo/pull/17558) by [@EvanBacon](https://github.com/EvanBacon))
18
+
19
+ ### 💡 Others
20
+
21
+ - Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
22
+
23
+ ## 1.2.0 — 2022-04-18
24
+
25
+ ### 💡 Others
26
+
27
+ - 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))
28
+
29
+ ### ⚠️ Notices
30
+
31
+ - 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))
32
+
33
+ ## 1.1.1 - 2022-02-01
34
+
35
+ ### 🐛 Bug fixes
36
+
37
+ - 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))
38
+
13
39
  ## 1.1.0 — 2021-12-03
14
40
 
15
41
  ### 🛠 Breaking changes
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## API documentation
6
6
 
7
- - [Documentation for the master branch][docs-main]
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/master/docs/pages/versions/unversioned/sdk/system-ui.md
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/
@@ -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.1.0'
6
+ version = '1.3.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:${safeExtGet('kotlinVersion', '1.4.21')}")
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
- // Put the androidSources and javadoc to the artifacts
35
- artifacts {
36
- archives androidSourcesJar
37
- }
38
-
39
- uploadArchives {
40
- repositories {
41
- mavenDeployer {
42
- configuration = configurations.deployerJars
43
- repository(url: mavenLocal().url)
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", 30)
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 31)
50
63
 
51
64
  compileOptions {
52
- sourceCompatibility JavaVersion.VERSION_1_8
53
- targetCompatibility JavaVersion.VERSION_1_8
65
+ sourceCompatibility JavaVersion.VERSION_11
66
+ targetCompatibility JavaVersion.VERSION_11
54
67
  }
55
68
 
56
69
  kotlinOptions {
57
- jvmTarget = JavaVersion.VERSION_1_8
70
+ jvmTarget = JavaVersion.VERSION_11.majorVersion
58
71
  }
59
72
 
60
73
  defaultConfig {
61
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
62
- targetSdkVersion safeExtGet("targetSdkVersion", 30)
75
+ targetSdkVersion safeExtGet("targetSdkVersion", 31)
63
76
  versionCode 1
64
- versionName '1.1.0'
77
+ versionName '1.3.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:${safeExtGet('kotlinVersion', '1.4.21')}"
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
  }
@@ -1,2 +1,3 @@
1
1
  declare const _default: import("expo-modules-core").ProxyNativeModule;
2
2
  export default _default;
3
+ //# sourceMappingURL=ExpoSystemUI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSystemUI.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.ts"],"names":[],"mappings":";AAEA,wBAAqD"}
@@ -4,3 +4,4 @@ declare const _default: {
4
4
  setBackgroundColorAsync(color: string): void;
5
5
  };
6
6
  export default _default;
7
+ //# sourceMappingURL=ExpoSystemUI.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSystemUI.web.d.ts","sourceRoot":"","sources":["../src/ExpoSystemUI.web.ts"],"names":[],"mappings":";;;mCAeiC,MAAM;;AAXvC,wBAgBE"}
@@ -19,3 +19,4 @@ export declare function setBackgroundColorAsync(color: ColorValue): Promise<void
19
19
  * @returns Current root view background color in hex format. Returns `null` if the background color is not set.
20
20
  */
21
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,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"}
package/build/SystemUI.js CHANGED
@@ -1,4 +1,4 @@
1
- import { processColor } from 'react-native';
1
+ import { Platform, processColor } from 'react-native';
2
2
  import ExpoSystemUI from './ExpoSystemUI';
3
3
  /**
4
4
  * Changes the root view background color.
@@ -10,7 +10,7 @@ import ExpoSystemUI from './ExpoSystemUI';
10
10
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
11
11
  */
12
12
  export async function setBackgroundColorAsync(color) {
13
- const colorNumber = processColor(color);
13
+ const colorNumber = Platform.OS === 'web' ? color : processColor(color);
14
14
  return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
15
15
  }
16
16
  /**
@@ -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. 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;;;;;;;;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"]}
@@ -3,28 +3,27 @@
3
3
  import ExpoModulesCore
4
4
 
5
5
  public class ExpoSystemUIModule: Module {
6
-
7
6
  public func definition() -> ModuleDefinition {
8
- name("ExpoSystemUI")
9
-
10
- onCreate {
7
+ Name("ExpoSystemUI")
8
+
9
+ OnCreate {
11
10
  // TODO: Maybe read from the app manifest instead of from Info.plist.
12
11
  // Set / reset the initial color on reload and app start.
13
12
  let color = Bundle.main.object(forInfoDictionaryKey: "RCTRootViewBackgroundColor") as? Int
14
13
  Self.setBackgroundColorAsync(color: color)
15
14
  }
16
15
 
17
- function("getBackgroundColorAsync") { () -> String? in
16
+ AsyncFunction("getBackgroundColorAsync") { () -> String? in
18
17
  Self.getBackgroundColor()
19
18
  }
20
19
 
21
- function("setBackgroundColorAsync") { (color: Int) in
20
+ AsyncFunction("setBackgroundColorAsync") { (color: Int) in
22
21
  Self.setBackgroundColorAsync(color: color)
23
22
  }
24
23
  }
25
24
 
26
25
  static func getBackgroundColor() -> String? {
27
- var color: String? = nil
26
+ var color: String?
28
27
  EXUtilities.performSynchronously {
29
28
  // Get the root view controller of the delegate window.
30
29
  if let window = UIApplication.shared.delegate?.window, let backgroundColor = window?.rootViewController?.view.backgroundColor?.cgColor {
@@ -33,10 +32,10 @@ public class ExpoSystemUIModule: Module {
33
32
  }
34
33
  return color
35
34
  }
36
-
35
+
37
36
  static func setBackgroundColorAsync(color: Int?) {
38
37
  EXUtilities.performSynchronously {
39
- if (color == nil) {
38
+ if color == nil {
40
39
  if let window = UIApplication.shared.delegate?.window {
41
40
  window?.backgroundColor = nil
42
41
  window?.rootViewController?.view.backgroundColor = UIColor.white
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-system-ui",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Interact with system UI elements",
5
5
  "main": "build/SystemUI.js",
6
6
  "types": "build/SystemUI.d.ts",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "author": "650 Industries, Inc.",
32
32
  "license": "MIT",
33
- "homepage": "https://docs.expo.io/versions/latest/sdk/system-ui",
33
+ "homepage": "https://docs.expo.dev/versions/latest/sdk/system-ui",
34
34
  "dependencies": {
35
- "@expo/config-plugins": "^4.0.2",
35
+ "@expo/config-plugins": "~5.0.0",
36
36
  "@react-native/normalize-color": "^2.0.0",
37
37
  "debug": "^4.3.2"
38
38
  },
@@ -45,5 +45,5 @@
45
45
  "peerDependencies": {
46
46
  "expo": "*"
47
47
  },
48
- "gitHead": "4ac89934e2acc4ef1fad59f338d9019fe2d92240"
48
+ "gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
49
49
  }
package/src/SystemUI.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ColorValue, processColor } from 'react-native';
1
+ import { ColorValue, Platform, processColor } from 'react-native';
2
2
 
3
3
  import ExpoSystemUI from './ExpoSystemUI';
4
4
 
@@ -12,7 +12,7 @@ import ExpoSystemUI from './ExpoSystemUI';
12
12
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
13
13
  */
14
14
  export async function setBackgroundColorAsync(color: ColorValue): Promise<void> {
15
- const colorNumber = processColor(color);
15
+ const colorNumber = Platform.OS === 'web' ? color : processColor(color);
16
16
  return await ExpoSystemUI.setBackgroundColorAsync(colorNumber);
17
17
  }
18
18
 
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "./build"
6
6
  },
7
7
  "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__stories__/*"]
9
9
  }