@expo/config-plugins 4.0.3 → 4.0.8

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 (109) hide show
  1. package/README.md +14 -0
  2. package/build/Plugin.types.js +6 -6
  3. package/build/android/AllowBackup.js +1 -1
  4. package/build/android/Colors.js +3 -3
  5. package/build/android/EasBuild.js +1 -1
  6. package/build/android/GoogleServices.js +3 -3
  7. package/build/android/IntentFilters.js +1 -1
  8. package/build/android/JsEngine.js +2 -1
  9. package/build/android/JsEngine.js.map +1 -1
  10. package/build/android/Manifest.js +10 -10
  11. package/build/android/Name.d.ts +2 -1
  12. package/build/android/Name.js +7 -4
  13. package/build/android/Name.js.map +1 -1
  14. package/build/android/Orientation.js +2 -1
  15. package/build/android/Orientation.js.map +1 -1
  16. package/build/android/Package.js +4 -4
  17. package/build/android/Package.js.map +1 -1
  18. package/build/android/Paths.js +9 -9
  19. package/build/android/Permissions.js +6 -6
  20. package/build/android/Resources.js +5 -5
  21. package/build/android/Scheme.js +3 -3
  22. package/build/android/StatusBar.js +3 -3
  23. package/build/android/Strings.js +1 -1
  24. package/build/android/Styles.js +5 -5
  25. package/build/android/Updates.d.ts +0 -5
  26. package/build/android/Updates.js +14 -23
  27. package/build/android/Updates.js.map +1 -1
  28. package/build/android/Version.js +2 -2
  29. package/build/android/WindowSoftInputMode.js +1 -1
  30. package/build/android/codeMod.js +2 -2
  31. package/build/android/index.d.ts +1 -4
  32. package/build/android/index.js +1 -52
  33. package/build/android/index.js.map +1 -1
  34. package/build/index.js +54 -53
  35. package/build/index.js.map +1 -1
  36. package/build/ios/Bitcode.d.ts +33 -0
  37. package/build/ios/Bitcode.js +131 -0
  38. package/build/ios/Bitcode.js.map +1 -0
  39. package/build/ios/BuildScheme.js +2 -2
  40. package/build/ios/BundleIdentifier.js +3 -3
  41. package/build/ios/DeviceFamily.js +3 -3
  42. package/build/ios/Entitlements.js +2 -2
  43. package/build/ios/Entitlements.js.map +1 -1
  44. package/build/ios/Google.js +2 -2
  45. package/build/ios/JsEngine.js +2 -1
  46. package/build/ios/JsEngine.js.map +1 -1
  47. package/build/ios/Locales.js +1 -1
  48. package/build/ios/Maps.js +32 -18
  49. package/build/ios/Maps.js.map +1 -1
  50. package/build/ios/Orientation.js +2 -1
  51. package/build/ios/Orientation.js.map +1 -1
  52. package/build/ios/Paths.js +14 -14
  53. package/build/ios/Paths.js.map +1 -1
  54. package/build/ios/Permissions.js +1 -1
  55. package/build/ios/Permissions.js.map +1 -1
  56. package/build/ios/Scheme.js +4 -4
  57. package/build/ios/Swift.js +2 -2
  58. package/build/ios/Target.js +5 -5
  59. package/build/ios/Updates.d.ts +0 -5
  60. package/build/ios/Updates.js +14 -23
  61. package/build/ios/Updates.js.map +1 -1
  62. package/build/ios/Version.js +3 -3
  63. package/build/ios/codeMod.js +2 -2
  64. package/build/ios/index.d.ts +2 -3
  65. package/build/ios/index.js +20 -35
  66. package/build/ios/index.js.map +1 -1
  67. package/build/ios/utils/Xcodeproj.js +9 -9
  68. package/build/plugins/android-plugins.js +1 -1
  69. package/build/plugins/createBaseMod.js +2 -2
  70. package/build/plugins/createBaseMod.js.map +1 -1
  71. package/build/plugins/ios-plugins.js +2 -2
  72. package/build/plugins/mod-compiler.js +3 -3
  73. package/build/plugins/mod-compiler.js.map +1 -1
  74. package/build/plugins/withAndroidBaseMods.js +1 -1
  75. package/build/plugins/withIosBaseMods.js +1 -1
  76. package/build/plugins/withStaticPlugin.js +16 -5
  77. package/build/plugins/withStaticPlugin.js.map +1 -1
  78. package/build/utils/Updates.d.ts +1 -0
  79. package/build/utils/Updates.js +24 -1
  80. package/build/utils/Updates.js.map +1 -1
  81. package/build/utils/XML.d.ts +6 -0
  82. package/build/utils/XML.js +57 -10
  83. package/build/utils/XML.js.map +1 -1
  84. package/build/utils/errors.js +1 -1
  85. package/build/utils/generateCode.js +2 -2
  86. package/build/utils/history.js +1 -1
  87. package/build/utils/modules.js +1 -1
  88. package/build/utils/plugin-resolver.js +4 -4
  89. package/build/utils/sortObject.js +2 -2
  90. package/build/utils/warnings.js +1 -1
  91. package/package.json +4 -4
  92. package/build/android/NavigationBar.d.ts +0 -9
  93. package/build/android/NavigationBar.js +0 -141
  94. package/build/android/NavigationBar.js.map +0 -1
  95. package/build/android/RootViewBackgroundColor.d.ts +0 -6
  96. package/build/android/RootViewBackgroundColor.js +0 -81
  97. package/build/android/RootViewBackgroundColor.js.map +0 -1
  98. package/build/android/UserInterfaceStyle.d.ts +0 -10
  99. package/build/android/UserInterfaceStyle.js +0 -119
  100. package/build/android/UserInterfaceStyle.js.map +0 -1
  101. package/build/ios/RootViewBackgroundColor.d.ts +0 -6
  102. package/build/ios/RootViewBackgroundColor.js +0 -70
  103. package/build/ios/RootViewBackgroundColor.js.map +0 -1
  104. package/build/ios/UserInterfaceStyle.d.ts +0 -5
  105. package/build/ios/UserInterfaceStyle.js +0 -59
  106. package/build/ios/UserInterfaceStyle.js.map +0 -1
  107. package/build/utils/resolvePackageRootFolder.d.ts +0 -1
  108. package/build/utils/resolvePackageRootFolder.js +0 -57
  109. package/build/utils/resolvePackageRootFolder.js.map +0 -1
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
7
- exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withRootViewBackgroundColor = void 0;
8
-
9
- function _androidPlugins() {
10
- const data = require("../plugins/android-plugins");
11
-
12
- _androidPlugins = function () {
13
- return data;
14
- };
15
-
16
- return data;
17
- }
18
-
19
- function _Colors() {
20
- const data = require("./Colors");
21
-
22
- _Colors = function () {
23
- return data;
24
- };
25
-
26
- return data;
27
- }
28
-
29
- function _Styles() {
30
- const data = require("./Styles");
31
-
32
- _Styles = function () {
33
- return data;
34
- };
35
-
36
- return data;
37
- }
38
-
39
- const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
40
- const WINDOW_BACKGROUND_COLOR = 'activityBackground';
41
-
42
- const withRootViewBackgroundColor = config => {
43
- config = withRootViewBackgroundColorColors(config);
44
- config = withRootViewBackgroundColorStyles(config);
45
- return config;
46
- };
47
-
48
- exports.withRootViewBackgroundColor = withRootViewBackgroundColor;
49
-
50
- const withRootViewBackgroundColorColors = config => {
51
- return (0, _androidPlugins().withAndroidColors)(config, async config => {
52
- config.modResults = (0, _Colors().assignColorValue)(config.modResults, {
53
- value: getRootViewBackgroundColor(config),
54
- name: WINDOW_BACKGROUND_COLOR
55
- });
56
- return config;
57
- });
58
- };
59
-
60
- exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
61
-
62
- const withRootViewBackgroundColorStyles = config => {
63
- return (0, _androidPlugins().withAndroidStyles)(config, async config => {
64
- config.modResults = (0, _Styles().assignStylesValue)(config.modResults, {
65
- add: !!getRootViewBackgroundColor(config),
66
- parent: (0, _Styles().getAppThemeLightNoActionBarGroup)(),
67
- name: ANDROID_WINDOW_BACKGROUND,
68
- value: `@color/${WINDOW_BACKGROUND_COLOR}`
69
- });
70
- return config;
71
- });
72
- };
73
-
74
- exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
75
-
76
- function getRootViewBackgroundColor(config) {
77
- var _config$android;
78
-
79
- return ((_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.backgroundColor) || config.backgroundColor || null;
80
- }
81
- //# sourceMappingURL=RootViewBackgroundColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/android/RootViewBackgroundColor.ts"],"names":["ANDROID_WINDOW_BACKGROUND","WINDOW_BACKGROUND_COLOR","withRootViewBackgroundColor","config","withRootViewBackgroundColorColors","withRootViewBackgroundColorStyles","modResults","value","getRootViewBackgroundColor","name","add","parent","android","backgroundColor"],"mappings":";;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,yBAAyB,GAAG,0BAAlC;AACA,MAAMC,uBAAuB,GAAG,oBAAhC;;AAEO,MAAMC,2BAAyC,GAAGC,MAAM,IAAI;AACjEA,EAAAA,MAAM,GAAGC,iCAAiC,CAACD,MAAD,CAA1C;AACAA,EAAAA,MAAM,GAAGE,iCAAiC,CAACF,MAAD,CAA1C;AACA,SAAOA,MAAP;AACD,CAJM;;;;AAMA,MAAMC,iCAA+C,GAAGD,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,gCAAiBH,MAAM,CAACG,UAAxB,EAAoC;AACtDC,MAAAA,KAAK,EAAEC,0BAA0B,CAACL,MAAD,CADqB;AAEtDM,MAAAA,IAAI,EAAER;AAFgD,KAApC,CAApB;AAIA,WAAOE,MAAP;AACD,GANM,CAAP;AAOD,CARM;;;;AAUA,MAAME,iCAA+C,GAAGF,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,iCAAkBH,MAAM,CAACG,UAAzB,EAAqC;AACvDI,MAAAA,GAAG,EAAE,CAAC,CAACF,0BAA0B,CAACL,MAAD,CADsB;AAEvDQ,MAAAA,MAAM,EAAE,iDAF+C;AAGvDF,MAAAA,IAAI,EAAET,yBAHiD;AAIvDO,MAAAA,KAAK,EAAG,UAASN,uBAAwB;AAJc,KAArC,CAApB;AAMA,WAAOE,MAAP;AACD,GARM,CAAP;AASD,CAVM;;;;AAYA,SAASK,0BAAT,CACLL,MADK,EAEL;AAAA;;AACA,SAAO,oBAAAA,MAAM,CAACS,OAAP,oEAAgBC,eAAhB,KAAmCV,MAAM,CAACU,eAA1C,IAA6D,IAApE;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidColors, withAndroidStyles } from '../plugins/android-plugins';\nimport { assignColorValue } from './Colors';\nimport { assignStylesValue, getAppThemeLightNoActionBarGroup } from './Styles';\n\nconst ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';\nconst WINDOW_BACKGROUND_COLOR = 'activityBackground';\n\nexport const withRootViewBackgroundColor: ConfigPlugin = config => {\n config = withRootViewBackgroundColorColors(config);\n config = withRootViewBackgroundColorStyles(config);\n return config;\n};\n\nexport const withRootViewBackgroundColorColors: ConfigPlugin = config => {\n return withAndroidColors(config, async config => {\n config.modResults = assignColorValue(config.modResults, {\n value: getRootViewBackgroundColor(config),\n name: WINDOW_BACKGROUND_COLOR,\n });\n return config;\n });\n};\n\nexport const withRootViewBackgroundColorStyles: ConfigPlugin = config => {\n return withAndroidStyles(config, async config => {\n config.modResults = assignStylesValue(config.modResults, {\n add: !!getRootViewBackgroundColor(config),\n parent: getAppThemeLightNoActionBarGroup(),\n name: ANDROID_WINDOW_BACKGROUND,\n value: `@color/${WINDOW_BACKGROUND_COLOR}`,\n });\n return config;\n });\n};\n\nexport function getRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'android' | 'backgroundColor'>\n) {\n return config.android?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"RootViewBackgroundColor.js"}
@@ -1,10 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { ConfigPlugin } from '../Plugin.types';
3
- import { AndroidManifest } from './Manifest';
4
- export declare const CONFIG_CHANGES_ATTRIBUTE = "android:configChanges";
5
- export declare const ON_CONFIGURATION_CHANGED = "\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n";
6
- export declare const withUiModeManifest: ConfigPlugin<void>;
7
- export declare const withUiModeMainActivity: ConfigPlugin;
8
- export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>): string;
9
- export declare function setUiModeAndroidManifest(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, androidManifest: AndroidManifest): AndroidManifest;
10
- export declare function addOnConfigurationChangedMainActivity(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, mainActivity: string): string;
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getUserInterfaceStyle = getUserInterfaceStyle;
7
- exports.setUiModeAndroidManifest = setUiModeAndroidManifest;
8
- exports.addOnConfigurationChangedMainActivity = addOnConfigurationChangedMainActivity;
9
- exports.withUiModeMainActivity = exports.withUiModeManifest = exports.ON_CONFIGURATION_CHANGED = exports.CONFIG_CHANGES_ATTRIBUTE = void 0;
10
-
11
- function _androidPlugins() {
12
- const data = require("../plugins/android-plugins");
13
-
14
- _androidPlugins = function () {
15
- return data;
16
- };
17
-
18
- return data;
19
- }
20
-
21
- function _warnings() {
22
- const data = require("../utils/warnings");
23
-
24
- _warnings = function () {
25
- return data;
26
- };
27
-
28
- return data;
29
- }
30
-
31
- function _Manifest() {
32
- const data = require("./Manifest");
33
-
34
- _Manifest = function () {
35
- return data;
36
- };
37
-
38
- return data;
39
- }
40
-
41
- function _codeMod() {
42
- const data = require("./codeMod");
43
-
44
- _codeMod = function () {
45
- return data;
46
- };
47
-
48
- return data;
49
- }
50
-
51
- const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';
52
- exports.CONFIG_CHANGES_ATTRIBUTE = CONFIG_CHANGES_ATTRIBUTE;
53
- const ON_CONFIGURATION_CHANGED = `
54
- public class MainActivity extends ReactActivity {
55
-
56
- // Added automatically by Expo Config
57
- @Override
58
- public void onConfigurationChanged(Configuration newConfig) {
59
- super.onConfigurationChanged(newConfig);
60
- Intent intent = new Intent("onConfigurationChanged");
61
- intent.putExtra("newConfig", newConfig);
62
- sendBroadcast(intent);
63
- }
64
- `;
65
- exports.ON_CONFIGURATION_CHANGED = ON_CONFIGURATION_CHANGED;
66
- const withUiModeManifest = (0, _androidPlugins().createAndroidManifestPlugin)(setUiModeAndroidManifest, 'withUiModeManifest');
67
- exports.withUiModeManifest = withUiModeManifest;
68
-
69
- const withUiModeMainActivity = config => {
70
- return (0, _androidPlugins().withMainActivity)(config, config => {
71
- if (config.modResults.language === 'java') {
72
- config.modResults.contents = addOnConfigurationChangedMainActivity(config, config.modResults.contents);
73
- } else {
74
- (0, _warnings().addWarningAndroid)('android.userInterfaceStyle', `Cannot automatically configure MainActivity if it's not java`);
75
- }
76
-
77
- return config;
78
- });
79
- };
80
-
81
- exports.withUiModeMainActivity = withUiModeMainActivity;
82
-
83
- function getUserInterfaceStyle(config) {
84
- var _ref, _config$android$userI, _config$android;
85
-
86
- return (_ref = (_config$android$userI = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.userInterfaceStyle) !== null && _config$android$userI !== void 0 ? _config$android$userI : config.userInterfaceStyle) !== null && _ref !== void 0 ? _ref : 'light';
87
- }
88
-
89
- function setUiModeAndroidManifest(config, androidManifest) {
90
- const userInterfaceStyle = getUserInterfaceStyle(config); // TODO: Remove this if we decide to remove any uiMode configuration when not specified
91
-
92
- if (!userInterfaceStyle) {
93
- return androidManifest;
94
- }
95
-
96
- const mainActivity = (0, _Manifest().getMainActivityOrThrow)(androidManifest);
97
- mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] = 'keyboard|keyboardHidden|orientation|screenSize|uiMode';
98
- return androidManifest;
99
- }
100
-
101
- function addOnConfigurationChangedMainActivity(config, mainActivity) {
102
- var _mainActivity$match;
103
-
104
- const userInterfaceStyle = getUserInterfaceStyle(config);
105
-
106
- if (!userInterfaceStyle) {
107
- return mainActivity;
108
- } // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java
109
-
110
-
111
- if ((_mainActivity$match = mainActivity.match(`onConfigurationChanged`)) !== null && _mainActivity$match !== void 0 && _mainActivity$match.length) {
112
- return mainActivity;
113
- }
114
-
115
- const MainActivityWithImports = (0, _codeMod().addImports)(mainActivity, ['android.content.Intent', 'android.content.res.Configuration'], true);
116
- const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);
117
- return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);
118
- }
119
- //# sourceMappingURL=UserInterfaceStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/android/UserInterfaceStyle.ts"],"names":["CONFIG_CHANGES_ATTRIBUTE","ON_CONFIGURATION_CHANGED","withUiModeManifest","setUiModeAndroidManifest","withUiModeMainActivity","config","modResults","language","contents","addOnConfigurationChangedMainActivity","getUserInterfaceStyle","android","userInterfaceStyle","androidManifest","mainActivity","$","match","length","MainActivityWithImports","pattern","RegExp","replace"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,wBAAwB,GAAG,uBAAjC;;AAEA,MAAMC,wBAAwB,GAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAXO;;AAaA,MAAMC,kBAAkB,GAAG,mDAChCC,wBADgC,EAEhC,oBAFgC,CAA3B;;;AAKA,MAAMC,sBAAoC,GAAGC,MAAM,IAAI;AAC5D,SAAO,wCAAiBA,MAAjB,EAAyBA,MAAM,IAAI;AACxC,QAAIA,MAAM,CAACC,UAAP,CAAkBC,QAAlB,KAA+B,MAAnC,EAA2C;AACzCF,MAAAA,MAAM,CAACC,UAAP,CAAkBE,QAAlB,GAA6BC,qCAAqC,CAChEJ,MADgE,EAEhEA,MAAM,CAACC,UAAP,CAAkBE,QAF8C,CAAlE;AAID,KALD,MAKO;AACL,yCACE,4BADF,EAEG,8DAFH;AAID;;AACD,WAAOH,MAAP;AACD,GAbM,CAAP;AAcD,CAfM;;;;AAiBA,SAASK,qBAAT,CACLL,MADK,EAEG;AAAA;;AACR,6DAAOA,MAAM,CAACM,OAAd,oDAAO,gBAAgBC,kBAAvB,yEAA6CP,MAAM,CAACO,kBAApD,uCAA0E,OAA1E;AACD;;AAEM,SAAST,wBAAT,CACLE,MADK,EAELQ,eAFK,EAGL;AACA,QAAMD,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD,CADA,CAEA;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOC,eAAP;AACD;;AAED,QAAMC,YAAY,GAAG,wCAAuBD,eAAvB,CAArB;AACAC,EAAAA,YAAY,CAACC,CAAb,CAAef,wBAAf,IACE,uDADF;AAGA,SAAOa,eAAP;AACD;;AAEM,SAASJ,qCAAT,CACLJ,MADK,EAELS,YAFK,EAGG;AAAA;;AACR,QAAMF,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOE,YAAP;AACD,GAJO,CAMR;;;AACA,6BAAIA,YAAY,CAACE,KAAb,CAAoB,wBAApB,CAAJ,gDAAI,oBAA8CC,MAAlD,EAA0D;AACxD,WAAOH,YAAP;AACD;;AAED,QAAMI,uBAAuB,GAAG,2BAC9BJ,YAD8B,EAE9B,CAAC,wBAAD,EAA2B,mCAA3B,CAF8B,EAG9B,IAH8B,CAAhC;AAMA,QAAMK,OAAO,GAAG,IAAIC,MAAJ,CAAY,mDAAZ,CAAhB;AACA,SAAOF,uBAAuB,CAACG,OAAxB,CAAgCF,OAAhC,EAAyClB,wBAAzC,CAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withMainActivity } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\nimport { addImports } from './codeMod';\n\nexport const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';\n\nexport const ON_CONFIGURATION_CHANGED = `\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n`;\n\nexport const withUiModeManifest = createAndroidManifestPlugin(\n setUiModeAndroidManifest,\n 'withUiModeManifest'\n);\n\nexport const withUiModeMainActivity: ConfigPlugin = config => {\n return withMainActivity(config, config => {\n if (config.modResults.language === 'java') {\n config.modResults.contents = addOnConfigurationChangedMainActivity(\n config,\n config.modResults.contents\n );\n } else {\n addWarningAndroid(\n 'android.userInterfaceStyle',\n `Cannot automatically configure MainActivity if it's not java`\n );\n }\n return config;\n });\n};\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>\n): string {\n return config.android?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';\n}\n\nexport function setUiModeAndroidManifest(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n androidManifest: AndroidManifest\n) {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n // TODO: Remove this if we decide to remove any uiMode configuration when not specified\n if (!userInterfaceStyle) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] =\n 'keyboard|keyboardHidden|orientation|screenSize|uiMode';\n\n return androidManifest;\n}\n\nexport function addOnConfigurationChangedMainActivity(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n mainActivity: string\n): string {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n if (!userInterfaceStyle) {\n return mainActivity;\n }\n\n // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java\n if (mainActivity.match(`onConfigurationChanged`)?.length) {\n return mainActivity;\n }\n\n const MainActivityWithImports = addImports(\n mainActivity,\n ['android.content.Intent', 'android.content.res.Configuration'],\n true\n );\n\n const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);\n return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);\n}\n"],"file":"UserInterfaceStyle.js"}
@@ -1,6 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { ConfigPlugin } from '../Plugin.types';
3
- import { InfoPlist } from './IosConfig.types';
4
- export declare const withRootViewBackgroundColor: ConfigPlugin;
5
- export declare function setRootViewBackgroundColor(config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>, infoPlist: InfoPlist): InfoPlist;
6
- export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>): string | null;
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setRootViewBackgroundColor = setRootViewBackgroundColor;
7
- exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
8
- exports.withRootViewBackgroundColor = void 0;
9
-
10
- function _normalizeColor() {
11
- const data = _interopRequireDefault(require("@react-native/normalize-color"));
12
-
13
- _normalizeColor = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- function _iosPlugins() {
21
- const data = require("../plugins/ios-plugins");
22
-
23
- _iosPlugins = function () {
24
- return data;
25
- };
26
-
27
- return data;
28
- }
29
-
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- // @ts-ignore: uses flow
33
- // Maps to the template AppDelegate.m
34
- const BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';
35
-
36
- const withRootViewBackgroundColor = config => {
37
- config = (0, _iosPlugins().withInfoPlist)(config, config => {
38
- config.modResults = setRootViewBackgroundColor(config, config.modResults);
39
- return config;
40
- });
41
- return config;
42
- };
43
-
44
- exports.withRootViewBackgroundColor = withRootViewBackgroundColor;
45
-
46
- function setRootViewBackgroundColor(config, infoPlist) {
47
- const backgroundColor = getRootViewBackgroundColor(config);
48
-
49
- if (!backgroundColor) {
50
- delete infoPlist[BACKGROUND_COLOR_KEY];
51
- } else {
52
- let color = (0, _normalizeColor().default)(backgroundColor);
53
-
54
- if (!color) {
55
- throw new Error('Invalid background color on iOS');
56
- }
57
-
58
- color = (color << 24 | color >>> 8) >>> 0;
59
- infoPlist[BACKGROUND_COLOR_KEY] = color;
60
- }
61
-
62
- return infoPlist;
63
- }
64
-
65
- function getRootViewBackgroundColor(config) {
66
- var _config$ios;
67
-
68
- return ((_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.backgroundColor) || config.backgroundColor || null;
69
- }
70
- //# sourceMappingURL=RootViewBackgroundColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ios/RootViewBackgroundColor.ts"],"names":["BACKGROUND_COLOR_KEY","withRootViewBackgroundColor","config","modResults","setRootViewBackgroundColor","infoPlist","backgroundColor","getRootViewBackgroundColor","color","Error","ios"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAJA;AAOA;AACA,MAAMA,oBAAoB,GAAG,4BAA7B;;AAEO,MAAMC,2BAAyC,GAAGC,MAAM,IAAI;AACjEA,EAAAA,MAAM,GAAG,iCAAcA,MAAd,EAAsBA,MAAM,IAAI;AACvCA,IAAAA,MAAM,CAACC,UAAP,GAAoBC,0BAA0B,CAACF,MAAD,EAASA,MAAM,CAACC,UAAhB,CAA9C;AACA,WAAOD,MAAP;AACD,GAHQ,CAAT;AAIA,SAAOA,MAAP;AACD,CANM;;;;AAQA,SAASE,0BAAT,CACLF,MADK,EAELG,SAFK,EAGM;AACX,QAAMC,eAAe,GAAGC,0BAA0B,CAACL,MAAD,CAAlD;;AACA,MAAI,CAACI,eAAL,EAAsB;AACpB,WAAOD,SAAS,CAACL,oBAAD,CAAhB;AACD,GAFD,MAEO;AACL,QAAIQ,KAAK,GAAG,+BAAeF,eAAf,CAAZ;;AACA,QAAI,CAACE,KAAL,EAAY;AACV,YAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;AACD;;AACDD,IAAAA,KAAK,GAAG,CAAEA,KAAK,IAAI,EAAV,GAAiBA,KAAK,KAAK,CAA5B,MAAoC,CAA5C;AACAH,IAAAA,SAAS,CAACL,oBAAD,CAAT,GAAkCQ,KAAlC;AACD;;AACD,SAAOH,SAAP;AACD;;AAEM,SAASE,0BAAT,CAAoCL,MAApC,EAAyF;AAAA;;AAC9F,SAAO,gBAAAA,MAAM,CAACQ,GAAP,4DAAYJ,eAAZ,KAA+BJ,MAAM,CAACI,eAAtC,IAAyD,IAAhE;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n// @ts-ignore: uses flow\nimport normalizeColor from '@react-native/normalize-color';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\n// Maps to the template AppDelegate.m\nconst BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';\n\nexport const withRootViewBackgroundColor: ConfigPlugin = config => {\n config = withInfoPlist(config, config => {\n config.modResults = setRootViewBackgroundColor(config, config.modResults);\n return config;\n });\n return config;\n};\n\nexport function setRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const backgroundColor = getRootViewBackgroundColor(config);\n if (!backgroundColor) {\n delete infoPlist[BACKGROUND_COLOR_KEY];\n } else {\n let color = normalizeColor(backgroundColor);\n if (!color) {\n throw new Error('Invalid background color on iOS');\n }\n color = ((color << 24) | (color >>> 8)) >>> 0;\n infoPlist[BACKGROUND_COLOR_KEY] = color;\n }\n return infoPlist;\n}\n\nexport function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>) {\n return config.ios?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"RootViewBackgroundColor.js"}
@@ -1,5 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { InfoPlist } from './IosConfig.types';
3
- export declare const withUserInterfaceStyle: import("..").ConfigPlugin<void>;
4
- export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>): string;
5
- export declare function setUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>, { UIUserInterfaceStyle, ...infoPlist }: InfoPlist): InfoPlist;
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getUserInterfaceStyle = getUserInterfaceStyle;
7
- exports.setUserInterfaceStyle = setUserInterfaceStyle;
8
- exports.withUserInterfaceStyle = void 0;
9
-
10
- function _iosPlugins() {
11
- const data = require("../plugins/ios-plugins");
12
-
13
- _iosPlugins = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- const withUserInterfaceStyle = (0, _iosPlugins().createInfoPlistPlugin)(setUserInterfaceStyle, 'withUserInterfaceStyle');
21
- exports.withUserInterfaceStyle = withUserInterfaceStyle;
22
-
23
- function getUserInterfaceStyle(config) {
24
- var _ref, _config$ios$userInter, _config$ios;
25
-
26
- return (_ref = (_config$ios$userInter = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.userInterfaceStyle) !== null && _config$ios$userInter !== void 0 ? _config$ios$userInter : config.userInterfaceStyle) !== null && _ref !== void 0 ? _ref : 'light';
27
- }
28
-
29
- function setUserInterfaceStyle(config, {
30
- UIUserInterfaceStyle,
31
- ...infoPlist
32
- }) {
33
- const userInterfaceStyle = getUserInterfaceStyle(config);
34
- const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);
35
-
36
- if (!style) {
37
- return infoPlist;
38
- }
39
-
40
- return { ...infoPlist,
41
- UIUserInterfaceStyle: style
42
- };
43
- }
44
-
45
- function mapUserInterfaceStyleForInfoPlist(userInterfaceStyle) {
46
- switch (userInterfaceStyle) {
47
- case 'light':
48
- return 'Light';
49
-
50
- case 'dark':
51
- return 'Dark';
52
-
53
- case 'automatic':
54
- return 'Automatic';
55
- }
56
-
57
- return null;
58
- }
59
- //# sourceMappingURL=UserInterfaceStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ios/UserInterfaceStyle.ts"],"names":["withUserInterfaceStyle","setUserInterfaceStyle","getUserInterfaceStyle","config","ios","userInterfaceStyle","UIUserInterfaceStyle","infoPlist","style","mapUserInterfaceStyleForInfoPlist"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,yCACpCC,qBADoC,EAEpC,wBAFoC,CAA/B;;;AAKA,SAASC,qBAAT,CACLC,MADK,EAEG;AAAA;;AACR,yDAAOA,MAAM,CAACC,GAAd,gDAAO,YAAYC,kBAAnB,yEAAyCF,MAAM,CAACE,kBAAhD,uCAAsE,OAAtE;AACD;;AAEM,SAASJ,qBAAT,CACLE,MADK,EAEL;AAAEG,EAAAA,oBAAF;AAAwB,KAAGC;AAA3B,CAFK,EAGM;AACX,QAAMF,kBAAkB,GAAGH,qBAAqB,CAACC,MAAD,CAAhD;AACA,QAAMK,KAAK,GAAGC,iCAAiC,CAACJ,kBAAD,CAA/C;;AAEA,MAAI,CAACG,KAAL,EAAY;AACV,WAAOD,SAAP;AACD;;AAED,SAAO,EACL,GAAGA,SADE;AAELD,IAAAA,oBAAoB,EAAEE;AAFjB,GAAP;AAID;;AAED,SAASC,iCAAT,CAA2CJ,kBAA3C,EAA8F;AAC5F,UAAQA,kBAAR;AACE,SAAK,OAAL;AACE,aAAO,OAAP;;AACF,SAAK,MAAL;AACE,aAAO,MAAP;;AACF,SAAK,WAAL;AACE,aAAO,WAAP;AANJ;;AASA,SAAO,IAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceStyle } from './IosConfig.types';\n\nexport const withUserInterfaceStyle = createInfoPlistPlugin(\n setUserInterfaceStyle,\n 'withUserInterfaceStyle'\n);\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>\n): string {\n return config.ios?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';\n}\n\nexport function setUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>,\n { UIUserInterfaceStyle, ...infoPlist }: InfoPlist\n): InfoPlist {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);\n\n if (!style) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n UIUserInterfaceStyle: style,\n };\n}\n\nfunction mapUserInterfaceStyleForInfoPlist(userInterfaceStyle: string): InterfaceStyle | null {\n switch (userInterfaceStyle) {\n case 'light':\n return 'Light';\n case 'dark':\n return 'Dark';\n case 'automatic':\n return 'Automatic';\n }\n\n return null;\n}\n"],"file":"UserInterfaceStyle.js"}
@@ -1 +0,0 @@
1
- export declare function resolvePackageRootFolder(fromDirectory: string, moduleId: string): string | null;
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolvePackageRootFolder = resolvePackageRootFolder;
7
-
8
- function _findUp() {
9
- const data = _interopRequireDefault(require("find-up"));
10
-
11
- _findUp = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function path() {
19
- const data = _interopRequireWildcard(require("path"));
20
-
21
- path = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _resolveFrom() {
29
- const data = _interopRequireDefault(require("resolve-from"));
30
-
31
- _resolveFrom = function () {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
-
40
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
-
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
-
44
- function resolvePackageRootFolder(fromDirectory, moduleId) {
45
- const resolved = _resolveFrom().default.silent(fromDirectory, moduleId);
46
-
47
- if (!resolved) return null; // Get the closest package.json to the node module
48
-
49
- const packageJson = _findUp().default.sync('package.json', {
50
- cwd: resolved
51
- });
52
-
53
- if (!packageJson) return null; // resolve the root folder for the node module
54
-
55
- return path().dirname(packageJson);
56
- }
57
- //# sourceMappingURL=resolvePackageRootFolder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/resolvePackageRootFolder.ts"],"names":["resolvePackageRootFolder","fromDirectory","moduleId","resolved","resolveFrom","silent","packageJson","findUp","sync","cwd","path","dirname"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAEO,SAASA,wBAAT,CAAkCC,aAAlC,EAAyDC,QAAzD,EAA0F;AAC/F,QAAMC,QAAQ,GAAGC,uBAAYC,MAAZ,CAAmBJ,aAAnB,EAAkCC,QAAlC,CAAjB;;AACA,MAAI,CAACC,QAAL,EAAe,OAAO,IAAP,CAFgF,CAG/F;;AACA,QAAMG,WAAW,GAAGC,kBAAOC,IAAP,CAAY,cAAZ,EAA4B;AAAEC,IAAAA,GAAG,EAAEN;AAAP,GAA5B,CAApB;;AACA,MAAI,CAACG,WAAL,EAAkB,OAAO,IAAP,CAL6E,CAM/F;;AACA,SAAOI,IAAI,GAACC,OAAL,CAAaL,WAAb,CAAP;AACD","sourcesContent":["import findUp from 'find-up';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\n\nexport function resolvePackageRootFolder(fromDirectory: string, moduleId: string): string | null {\n const resolved = resolveFrom.silent(fromDirectory, moduleId);\n if (!resolved) return null;\n // Get the closest package.json to the node module\n const packageJson = findUp.sync('package.json', { cwd: resolved });\n if (!packageJson) return null;\n // resolve the root folder for the node module\n return path.dirname(packageJson);\n}\n"],"file":"resolvePackageRootFolder.js"}