@amazon-devices/expo-system-ui 2.0.9000000002 → 3.0.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.
Files changed (53) hide show
  1. package/build/ExpoSystemUI.kepler.js +2 -2
  2. package/build/ExpoSystemUI.kepler.js.map +1 -1
  3. package/lib/aarch64-release/libexpo-system-ui-3.so +0 -0
  4. package/lib/armv7-release/libexpo-system-ui-3.so +0 -0
  5. package/lib/x86_64-release/libexpo-system-ui-3.so +0 -0
  6. package/package.json +1 -1
  7. package/react-native.config.js +5 -4
  8. package/.eslintrc.js +0 -2
  9. package/CHANGELOG.md +0 -116
  10. package/CMakeLists.txt +0 -46
  11. package/THIRD_PARTY_NOTICES.txt +0 -4
  12. package/android/build.gradle +0 -112
  13. package/android/src/main/AndroidManifest.xml +0 -2
  14. package/android/src/main/java/expo/modules/systemui/SystemUIModule.kt +0 -74
  15. package/android/src/main/java/expo/modules/systemui/SystemUIPackage.kt +0 -11
  16. package/android/src/main/java/expo/modules/systemui/SystemUIReactActivityLifecycleListener.kt +0 -18
  17. package/android/src/main/java/expo/modules/systemui/singletons/SystemUI.kt +0 -36
  18. package/android/src/main/res/values/strings.xml +0 -4
  19. package/app.plugin.js +0 -1
  20. package/expo-module.config.json +0 -10
  21. package/ios/ExpoSystemUI/ExpoSystemUIModule.swift +0 -72
  22. package/ios/ExpoSystemUI.podspec +0 -31
  23. package/kepler/ExpoSystemUI.cpp +0 -47
  24. package/kepler/ExpoSystemUI.h +0 -29
  25. package/kepler/ExpoSystemUIImpl.cpp +0 -39
  26. package/kepler/ExpoSystemUIImpl.h +0 -29
  27. package/kepler/ExpoSystemUITurboModule.cpp +0 -57
  28. package/kepler/ExpoSystemUITurboModule.h +0 -32
  29. package/kepler/KeplerInit.cpp +0 -28
  30. package/kepler/test/ExpoSystemUI.cpp +0 -154
  31. package/kepler-compatibility.json +0 -8
  32. package/plugin/babel.config.js +0 -1
  33. package/plugin/build/withAndroidRootViewBackgroundColor.d.ts +0 -6
  34. package/plugin/build/withAndroidRootViewBackgroundColor.js +0 -40
  35. package/plugin/build/withAndroidUserInterfaceStyle.d.ts +0 -8
  36. package/plugin/build/withAndroidUserInterfaceStyle.js +0 -42
  37. package/plugin/build/withIosRootViewBackgroundColor.d.ts +0 -5
  38. package/plugin/build/withIosRootViewBackgroundColor.js +0 -41
  39. package/plugin/build/withIosUserInterfaceStyle.d.ts +0 -5
  40. package/plugin/build/withIosUserInterfaceStyle.js +0 -38
  41. package/plugin/build/withSystemUI.d.ts +0 -3
  42. package/plugin/build/withSystemUI.js +0 -17
  43. package/plugin/src/withAndroidRootViewBackgroundColor.ts +0 -47
  44. package/plugin/src/withAndroidUserInterfaceStyle.ts +0 -53
  45. package/plugin/src/withIosRootViewBackgroundColor.ts +0 -41
  46. package/plugin/src/withIosUserInterfaceStyle.ts +0 -47
  47. package/plugin/src/withSystemUI.ts +0 -19
  48. package/plugin/tsconfig.json +0 -9
  49. package/src/ExpoSystemUI.kepler.ts +0 -27
  50. package/src/ExpoSystemUI.ts +0 -2
  51. package/src/ExpoSystemUI.web.ts +0 -21
  52. package/src/SystemUI.ts +0 -35
  53. package/tsconfig.json +0 -9
@@ -1,53 +0,0 @@
1
- import assert from 'assert';
2
- import { ExpoConfig } from 'expo/config';
3
- import { AndroidConfig, ConfigPlugin, withStringsXml } from 'expo/config-plugins';
4
-
5
- export type Props = {
6
- userInterfaceStyle?: ExpoConfig['userInterfaceStyle'];
7
- };
8
-
9
- // strings.xml keys, this should not change.
10
- const USER_INTERFACE_STYLE_KEY = 'expo_system_ui_user_interface_style';
11
-
12
- export const withAndroidUserInterfaceStyle: ConfigPlugin<void> = (config) => {
13
- return withStringsXml(config, (config) => {
14
- config.modResults = setStrings(config.modResults, resolveProps(config));
15
- return config;
16
- });
17
- };
18
-
19
- export function resolveProps(config: Pick<ExpoConfig, 'userInterfaceStyle' | 'android'>): Props {
20
- const userInterfaceStyle = config.android?.userInterfaceStyle ?? config.userInterfaceStyle;
21
-
22
- assert(
23
- !userInterfaceStyle || ['automatic', 'light', 'dark'].includes(userInterfaceStyle),
24
- `expo-system-ui: Invalid userInterfaceStyle: "${userInterfaceStyle}"`
25
- );
26
-
27
- return { userInterfaceStyle };
28
- }
29
-
30
- export function setStrings(
31
- strings: AndroidConfig.Resources.ResourceXML,
32
- { userInterfaceStyle }: Props
33
- ): AndroidConfig.Resources.ResourceXML {
34
- const pairs = [[USER_INTERFACE_STYLE_KEY, userInterfaceStyle]] as [string, any][];
35
-
36
- const stringItems: AndroidConfig.Resources.ResourceItemXML[] = [];
37
- for (const [key, value] of pairs) {
38
- if (value == null) {
39
- // Since we're using custom strings, we can remove them for convenience between prebuilds.
40
- strings = AndroidConfig.Strings.removeStringItem(key, strings);
41
- } else {
42
- stringItems.push(
43
- AndroidConfig.Resources.buildResourceItem({
44
- name: key,
45
- value: String(value),
46
- translatable: false,
47
- })
48
- );
49
- }
50
- }
51
-
52
- return AndroidConfig.Strings.setStringItem(stringItems, strings);
53
- }
@@ -1,41 +0,0 @@
1
- // @ts-ignore: uses flow
2
- import normalizeColor from '@react-native/normalize-color';
3
- import { ExpoConfig } from 'expo/config';
4
- import { ConfigPlugin, InfoPlist, withInfoPlist } from 'expo/config-plugins';
5
-
6
- // Maps to the template AppDelegate.m
7
- const BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';
8
-
9
- const debug = require('debug')('expo:system-ui:plugin:ios');
10
-
11
- export const withIosRootViewBackgroundColor: ConfigPlugin = (config) => {
12
- config = withInfoPlist(config, (config) => {
13
- config.modResults = setRootViewBackgroundColor(config, config.modResults);
14
- return config;
15
- });
16
- return config;
17
- };
18
-
19
- export function setRootViewBackgroundColor(
20
- config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>,
21
- infoPlist: InfoPlist
22
- ): InfoPlist {
23
- const backgroundColor = getRootViewBackgroundColor(config);
24
- if (!backgroundColor) {
25
- delete infoPlist[BACKGROUND_COLOR_KEY];
26
- } else {
27
- let color = normalizeColor(backgroundColor);
28
- if (!color) {
29
- throw new Error('Invalid background color on iOS');
30
- }
31
- color = ((color << 24) | (color >>> 8)) >>> 0;
32
- infoPlist[BACKGROUND_COLOR_KEY] = color;
33
-
34
- debug(`Convert color: ${backgroundColor} -> ${color}`);
35
- }
36
- return infoPlist;
37
- }
38
-
39
- export function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>) {
40
- return config.ios?.backgroundColor || config.backgroundColor || null;
41
- }
@@ -1,47 +0,0 @@
1
- import { ExpoConfig } from 'expo/config';
2
- import { InfoPlist, ConfigPlugin, withInfoPlist } from 'expo/config-plugins';
3
-
4
- export const withIosUserInterfaceStyle: ConfigPlugin = (config) => {
5
- return withInfoPlist(config, (config) => {
6
- config.modResults = setUserInterfaceStyle(config, config.modResults);
7
- return config;
8
- });
9
- };
10
-
11
- export function getUserInterfaceStyle(
12
- config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>
13
- ): string {
14
- return config.ios?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';
15
- }
16
-
17
- export function setUserInterfaceStyle(
18
- config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>,
19
- { UIUserInterfaceStyle, ...infoPlist }: InfoPlist
20
- ): InfoPlist {
21
- const userInterfaceStyle = getUserInterfaceStyle(config);
22
- const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);
23
-
24
- if (!style) {
25
- return infoPlist;
26
- }
27
-
28
- return {
29
- ...infoPlist,
30
- UIUserInterfaceStyle: style,
31
- };
32
- }
33
-
34
- function mapUserInterfaceStyleForInfoPlist(
35
- userInterfaceStyle: string
36
- ): NonNullable<InfoPlist['UIUserInterfaceStyle']> | null {
37
- switch (userInterfaceStyle) {
38
- case 'light':
39
- return 'Light';
40
- case 'dark':
41
- return 'Dark';
42
- case 'automatic':
43
- return 'Automatic';
44
- }
45
-
46
- return null;
47
- }
@@ -1,19 +0,0 @@
1
- import { ConfigPlugin, createRunOncePlugin, withPlugins } from 'expo/config-plugins';
2
-
3
- import { withAndroidRootViewBackgroundColor } from './withAndroidRootViewBackgroundColor';
4
- import { withAndroidUserInterfaceStyle } from './withAndroidUserInterfaceStyle';
5
- import { withIosRootViewBackgroundColor } from './withIosRootViewBackgroundColor';
6
- import { withIosUserInterfaceStyle } from './withIosUserInterfaceStyle';
7
-
8
- const pkg = require('expo-system-ui/package.json');
9
-
10
- const withSystemUI: ConfigPlugin = (config) => {
11
- return withPlugins(config, [
12
- withAndroidRootViewBackgroundColor,
13
- withIosRootViewBackgroundColor,
14
- withAndroidUserInterfaceStyle,
15
- withIosUserInterfaceStyle,
16
- ]);
17
- };
18
-
19
- export default createRunOncePlugin(withSystemUI, pkg.name, pkg.version);
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "expo-module-scripts/tsconfig.plugin",
3
- "compilerOptions": {
4
- "outDir": "build",
5
- "rootDir": "src"
6
- },
7
- "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
9
- }
@@ -1,27 +0,0 @@
1
- import { KeplerTurboModule, TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
2
-
3
- interface Spec extends KeplerTurboModule {
4
- readonly getBackgroundColorAsync: () => Promise<string>;
5
- readonly resetBackgroundColorAsync: () => Promise<void>;
6
- readonly setBackgroundColorAsync: (color: number) => Promise<void>;
7
- }
8
-
9
- const nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoSystemUI') as Spec;
10
-
11
- interface KeplerSystemUI {
12
- readonly getBackgroundColorAsync: () => Promise<string | null>;
13
- readonly setBackgroundColorAsync: (color: number | null) => Promise<void | null>;
14
- }
15
-
16
- const module: KeplerSystemUI = {
17
- async getBackgroundColorAsync() {
18
- return nativeModule.getBackgroundColorAsync();
19
- },
20
- async setBackgroundColorAsync(color: number | null) {
21
- return color
22
- ? nativeModule.setBackgroundColorAsync(color)
23
- : nativeModule.resetBackgroundColorAsync();
24
- },
25
- };
26
-
27
- export default module;
@@ -1,2 +0,0 @@
1
- import { requireNativeModule } from 'expo-modules-core';
2
- export default requireNativeModule('ExpoSystemUI');
@@ -1,21 +0,0 @@
1
- import { Platform } from 'expo-modules-core';
2
- // @ts-ignore: untyped
3
- import normalizeColor from 'react-native-web/dist/cjs/modules/normalizeColor';
4
-
5
- export default {
6
- get name(): string {
7
- return 'ExpoSystemUI';
8
- },
9
- getBackgroundColorAsync() {
10
- if (Platform.isDOMAvailable) {
11
- return normalizeColor(document.body.style.backgroundColor);
12
- } else {
13
- return null;
14
- }
15
- },
16
- setBackgroundColorAsync(color: string | null) {
17
- if (Platform.isDOMAvailable) {
18
- document.body.style.backgroundColor = color ?? 'white';
19
- }
20
- },
21
- };
package/src/SystemUI.ts DELETED
@@ -1,35 +0,0 @@
1
- import { ColorValue, Platform, processColor } from 'react-native';
2
-
3
- import ExpoSystemUI from './ExpoSystemUI';
4
-
5
- /**
6
- * Changes the root view background color.
7
- * Call this function in the root file outside of you component.
8
- *
9
- * @example
10
- * ```ts
11
- * SystemUI.setBackgroundColorAsync("black");
12
- * ```
13
- * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
14
- */
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
- }
22
- }
23
-
24
- /**
25
- * Gets the root view background color.
26
- *
27
- * @example
28
- * ```ts
29
- * const color = await SystemUI.getBackgroundColorAsync();
30
- * ```
31
- * @returns Current root view background color in hex format. Returns `null` if the background color is not set.
32
- */
33
- export async function getBackgroundColorAsync(): Promise<ColorValue | null> {
34
- return await ExpoSystemUI.getBackgroundColorAsync();
35
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- // @generated by expo-module-scripts
2
- {
3
- "extends": "expo-module-scripts/tsconfig.base",
4
- "compilerOptions": {
5
- "outDir": "./build"
6
- },
7
- "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
9
- }