@expo/prebuild-config 3.0.2 → 3.0.7
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/build/plugins/unversioned/{expo-branch.d.ts → expo-branch/expo-branch.d.ts} +0 -0
- package/build/plugins/unversioned/expo-branch/expo-branch.js +46 -0
- package/build/plugins/unversioned/expo-branch/expo-branch.js.map +1 -0
- package/build/plugins/unversioned/expo-branch/withAndroidBranch.d.ts +5 -0
- package/build/plugins/unversioned/expo-branch/withAndroidBranch.js +57 -0
- package/build/plugins/unversioned/expo-branch/withAndroidBranch.js.map +1 -0
- package/build/plugins/unversioned/expo-branch/withIosBranch.d.ts +5 -0
- package/build/plugins/unversioned/expo-branch/withIosBranch.js +48 -0
- package/build/plugins/unversioned/expo-branch/withIosBranch.js.map +1 -0
- package/build/plugins/unversioned/{expo-facebook.d.ts → expo-facebook/expo-facebook.d.ts} +0 -0
- package/build/plugins/unversioned/expo-facebook/expo-facebook.js +57 -0
- package/build/plugins/unversioned/expo-facebook/expo-facebook.js.map +1 -0
- package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.d.ts +13 -0
- package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js +235 -0
- package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js.map +1 -0
- package/build/plugins/unversioned/expo-facebook/withIosFacebook.d.ts +26 -0
- package/build/plugins/unversioned/expo-facebook/withIosFacebook.js +233 -0
- package/build/plugins/unversioned/expo-facebook/withIosFacebook.js.map +1 -0
- package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.d.ts +9 -0
- package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.js +69 -0
- package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.js.map +1 -0
- package/build/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.d.ts +2 -0
- package/build/plugins/unversioned/{expo-branch.js → expo-navigation-bar/expo-navigation-bar.js} +10 -9
- package/build/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.js.map +1 -0
- package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.d.ts +8 -0
- package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js +100 -0
- package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js.map +1 -0
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +11 -4
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js +30 -17
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js +11 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +38 -11
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.js +3 -2
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.js.map +1 -1
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.d.ts +2 -0
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js +64 -0
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.d.ts +6 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js +70 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.d.ts +2 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js +34 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.d.ts +5 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js +73 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.d.ts +5 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js +65 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js.map +1 -0
- package/build/plugins/withDefaultPlugins.js +30 -9
- package/build/plugins/withDefaultPlugins.js.map +1 -1
- package/package.json +5 -5
- package/build/plugins/unversioned/expo-branch.js.map +0 -1
- package/build/plugins/unversioned/expo-facebook.js +0 -34
- package/build/plugins/unversioned/expo-facebook.js.map +0 -1
|
@@ -17,6 +17,16 @@ function _configPlugins() {
|
|
|
17
17
|
return data;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function _imageUtils() {
|
|
21
|
+
const data = require("@expo/image-utils");
|
|
22
|
+
|
|
23
|
+
_imageUtils = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
function _fsExtra() {
|
|
21
31
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
22
32
|
|
|
@@ -49,6 +59,7 @@ function _getAndroidSplashConfig() {
|
|
|
49
59
|
|
|
50
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
61
|
|
|
62
|
+
const IMAGE_CACHE_NAME = 'splash-android';
|
|
52
63
|
const SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';
|
|
53
64
|
const DRAWABLES_CONFIGS = {
|
|
54
65
|
default: {
|
|
@@ -169,27 +180,29 @@ async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot)
|
|
|
169
180
|
const image = config[imageKey];
|
|
170
181
|
|
|
171
182
|
if (image) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
183
|
+
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
184
|
+
// this method also supports remote URLs and using the global sharp instance.
|
|
185
|
+
const {
|
|
186
|
+
source
|
|
187
|
+
} = await (0, _imageUtils().generateImageAsync)({
|
|
188
|
+
projectRoot,
|
|
189
|
+
cacheType: IMAGE_CACHE_NAME
|
|
190
|
+
}, {
|
|
191
|
+
src: image
|
|
192
|
+
}); // Get output path for drawable.
|
|
175
193
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* @param srcPath Absolute path
|
|
181
|
-
* @param dstPath Absolute path
|
|
182
|
-
*/
|
|
194
|
+
const outputPath = _path().default.join(androidMainPath, // @ts-ignore
|
|
195
|
+
DRAWABLES_CONFIGS[imageKey].modes[theme].path); // Ensure directory exists.
|
|
183
196
|
|
|
184
197
|
|
|
185
|
-
|
|
186
|
-
if (!srcPath) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
198
|
+
const folder = _path().default.dirname(outputPath);
|
|
189
199
|
|
|
190
|
-
|
|
200
|
+
await _fsExtra().default.ensureDir(folder); // Write image buffer to the file system.
|
|
191
201
|
|
|
192
|
-
|
|
193
|
-
|
|
202
|
+
await _fsExtra().default.writeFile(outputPath, source);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return null;
|
|
206
|
+
}));
|
|
194
207
|
}
|
|
195
208
|
//# sourceMappingURL=withAndroidSplashImages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"names":["SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","darkSplash","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"names":["IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","darkSplash","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","source","cacheType","src","outputPath","folder","dirname","ensureDir","writeFile"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AASA,MAAMA,gBAAgB,GAAG,gBAAzB;AACA,MAAMC,sBAAsB,GAAG,wBAA/B;AACA,MAAMC,iBASL,GAAG;AACFC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAG,kBAAiBL,sBAAuB;AAD1C,OADF;AAILM,MAAAA,IAAI,EAAE;AACJD,QAAAA,IAAI,EAAG,wBAAuBL,sBAAuB;AADjD;AAJD,KADA;AASPO,IAAAA,oBAAoB,EAAE;AATf,GADP;AAYFC,EAAAA,IAAI,EAAE;AACJL,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAG,uBAAsBL,sBAAuB;AAD/C,OADF;AAILM,MAAAA,IAAI,EAAE;AACJD,QAAAA,IAAI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f,CACLT,MADK,EAELoB,KAFK,EAGLjB,WAHK,EAIL;AACA,MAAI,CAACH,MAAL,EAAa;;AACb,QAAMU,eAAe,GAAGnB,gBAAKoB,IAAL,CAAUR,WAAV,EAAuB,sBAAvB,CAAxB;;AAEA,QAAMI,OAAO,CAACC,GAAR,CACJ,CAAC,MAAD,EAAS,MAAT,EAAiB,OAAjB,EAA0B,QAA1B,EAAoC,SAApC,EAA+CM,GAA/C,CAAmD,MAAMO,QAAN,IAAkB;AACnE;AACA,UAAMC,KAAK,GAAGtB,MAAM,CAACqB,QAAD,CAApB;;AACA,QAAIC,KAAJ,EAAW;AACT;AACA;AACA,YAAM;AAAEC,QAAAA;AAAF,UAAa,MAAM,sCAAmB;AAAEpB,QAAAA,WAAF;AAAeqB,QAAAA,SAAS,EAAEvC;AAA1B,OAAnB,EAAiE;AACxFwC,QAAAA,GAAG,EAAEH;AADmF,OAAjE,CAAzB,CAHS,CAOT;;AACA,YAAMI,UAAU,GAAGnC,gBAAKoB,IAAL,CACjBD,eADiB,EAEjB;AACAvB,MAAAA,iBAAiB,CAACkC,QAAD,CAAjB,CAA4BhC,KAA5B,CAAkC+B,KAAlC,EAAyC7B,IAHxB,CAAnB,CARS,CAaT;;;AACA,YAAMoC,MAAM,GAAGpC,gBAAKqC,OAAL,CAAaF,UAAb,CAAf;;AACA,YAAMV,mBAAGa,SAAH,CAAaF,MAAb,CAAN,CAfS,CAgBT;;AACA,YAAMX,mBAAGc,SAAH,CAAaJ,UAAb,EAAyBH,MAAzB,CAAN;AACD;;AACD,WAAO,IAAP;AACD,GAvBD,CADI,CAAN;AA0BD","sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport { generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n projectRoot: string\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config);\n const darkSplash = getAndroidDarkSplashConfig(config);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async imageKey => {\n // @ts-ignore\n const image = config[imageKey];\n if (image) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: image,\n } as any);\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n // @ts-ignore\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n // Ensure directory exists.\n const folder = path.dirname(outputPath);\n await fs.ensureDir(folder);\n // Write image buffer to the file system.\n await fs.writeFile(outputPath, source);\n }\n return null;\n })\n );\n}\n"],"file":"withAndroidSplashImages.js"}
|
|
@@ -16,6 +16,16 @@ function _configPlugins() {
|
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
function _codeMod() {
|
|
20
|
+
const data = require("@expo/config-plugins/build/android/codeMod");
|
|
21
|
+
|
|
22
|
+
_codeMod = function () {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
function _generateCode() {
|
|
20
30
|
const data = require("@expo/config-plugins/build/utils/generateCode");
|
|
21
31
|
|
|
@@ -89,7 +99,7 @@ function setSplashScreenLegacyMainActivity(config, mainActivity, language) {
|
|
|
89
99
|
} = splashConfig;
|
|
90
100
|
const isJava = language === 'java';
|
|
91
101
|
const LE = isJava ? ';' : '';
|
|
92
|
-
mainActivity =
|
|
102
|
+
mainActivity = (0, _codeMod().addImports)(mainActivity, ['expo.modules.splashscreen.SplashScreen', 'expo.modules.splashscreen.SplashScreenImageResizeMode', 'android.os.Bundle'], isJava);
|
|
93
103
|
|
|
94
104
|
if (!mainActivity.match(/(?<=^.*super\.onCreate.*$)/m)) {
|
|
95
105
|
const onCreateBlock = isJava ? [' @Override', ' protected void onCreate(Bundle savedInstanceState) {', ' super.onCreate(savedInstanceState);', ' }'] : [' override fun onCreate(savedInstanceState: Bundle?) {', ' super.onCreate(savedInstanceState)', ' }'];
|
package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.ts"],"names":["debug","SHOW_SPLASH_ID","withAndroidSplashLegacyMainActivity","config","modResults","contents","setSplashScreenLegacyMainActivity","language","mainActivity","splashConfig","mod","src","tag","didClear","statusBarTranslucent","androidStatusBar","translucent","resizeMode","isJava","LE","
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.ts"],"names":["debug","SHOW_SPLASH_ID","withAndroidSplashLegacyMainActivity","config","modResults","contents","setSplashScreenLegacyMainActivity","language","mainActivity","splashConfig","mod","src","tag","didClear","statusBarTranslucent","androidStatusBar","translucent","resizeMode","isJava","LE","match","onCreateBlock","anchor","offset","comment","newSrc","join","split","filter","line","test","toUpperCase"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA,MAAMA,KAAK,GAAG,sBAAM,8DAAN,CAAd,C,CAEA;;AACA,MAAMC,cAAc,GAAG,sDAAvB;;AAEO,MAAMC,mCAAiD,GAAGC,MAAM,IAAI;AACzE,SAAO,uCAAiBA,MAAjB,EAAyBA,MAAM,IAAI;AACxCA,IAAAA,MAAM,CAACC,UAAP,CAAkBC,QAAlB,GAA6BC,iCAAiC,CAC5DH,MAD4D,EAE5DA,MAAM,CAACC,UAAP,CAAkBC,QAF0C,EAG5DF,MAAM,CAACC,UAAP,CAAkBG,QAH0C,CAA9D;AAKA,WAAOJ,MAAP;AACD,GAPM,CAAP;AAQD,CATM;;;;AAWA,SAASG,iCAAT,CACLH,MADK,EAELK,YAFK,EAGLD,QAHK,EAIG;AAAA;;AACRP,EAAAA,KAAK,CAAE,0BAAyBO,QAAS,GAApC,CAAL;AACA,QAAME,YAAY,GAAG,sDAAuBN,MA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O,CA6DR;;;AACAG,EAAAA,YAAY,GAAG,oCAAe;AAC5BG,IAAAA,GAAG,EAAEH,YADuB;AAE5BI,IAAAA,GAAG,EAAEX;AAFuB,GAAf,EAGZI,QAHH,CA9DQ,CAmER;;AACAG,EAAAA,YAAY,GAAGA,YAAY,CACxBmB,KADY,CACN,IADM,EAEZC,MAFY,CAELC,IAAI,IAAI;AACd,WAAO,CAAC,4DAA4DC,IAA5D,CAAiED,IAAjE,CAAR;AACD,GAJY,EAKZH,IALY,CAKP,IALO,CAAf,CApEQ,CA2ER;;AACAlB,EAAAA,YAAY,GAAG,mCAAc;AAC3BG,IAAAA,GAAG,EAAEH,YADsB;AAE3B;AACAc,IAAAA,MAAM,EAAE,6BAHmB;AAI3BC,IAAAA,MAAM,EAAE,CAJmB;AAK3BC,IAAAA,OAAO,EAAE,IALkB;AAM3BZ,IAAAA,GAAG,EAAEX,cANsB;AAO3BwB,IAAAA,MAAM,EAAG,2DAA0DR,UAAU,CAACc,WAAX,EAAyB,kBAC1Fb,MAAM,GAAG,QAAH,GAAc,cACrB,KAAIJ,oBAAqB,IAAGK,EAAG;AATL,GAAd,EAUZd,QAVH,CA5EQ,CAwFR;;AAEA,SAAOG,YAAP;AACD","sourcesContent":["import { ConfigPlugin, withMainActivity } from '@expo/config-plugins';\nimport { addImports } from '@expo/config-plugins/build/android/codeMod';\nimport { mergeContents, removeContents } from '@expo/config-plugins/build/utils/generateCode';\nimport { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\n\nimport { getAndroidSplashConfig } from './getAndroidSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:android:mainActivity');\n\n// DO NOT CHANGE\nconst SHOW_SPLASH_ID = 'expo-splash-screen-mainActivity-onCreate-show-splash';\n\nexport const withAndroidSplashLegacyMainActivity: ConfigPlugin = config => {\n return withMainActivity(config, config => {\n config.modResults.contents = setSplashScreenLegacyMainActivity(\n config,\n config.modResults.contents,\n config.modResults.language\n );\n return config;\n });\n};\n\nexport function setSplashScreenLegacyMainActivity(\n config: Pick<ExpoConfig, 'android' | 'androidStatusBar' | 'userInterfaceStyle'>,\n mainActivity: string,\n language: 'java' | 'kt'\n): string {\n debug(`Modify with language: \"${language}\"`);\n const splashConfig = getAndroidSplashConfig(config);\n\n if (!splashConfig) {\n // Remove our generated code safely...\n const mod = removeContents({\n src: mainActivity,\n tag: SHOW_SPLASH_ID,\n });\n\n mainActivity = mod.contents;\n if (mod.didClear) {\n debug('Removed SplashScreen.show()');\n }\n return mainActivity;\n }\n // TODO: Translucent is weird\n const statusBarTranslucent = !!config.androidStatusBar?.translucent;\n\n const { resizeMode } = splashConfig;\n const isJava = language === 'java';\n const LE = isJava ? ';' : '';\n\n mainActivity = addImports(\n mainActivity,\n [\n 'expo.modules.splashscreen.SplashScreen',\n 'expo.modules.splashscreen.SplashScreenImageResizeMode',\n 'android.os.Bundle',\n ],\n isJava\n );\n\n if (!mainActivity.match(/(?<=^.*super\\.onCreate.*$)/m)) {\n const onCreateBlock = isJava\n ? [\n ' @Override',\n ' protected void onCreate(Bundle savedInstanceState) {',\n ' super.onCreate(savedInstanceState);',\n ' }',\n ]\n : [\n ' override fun onCreate(savedInstanceState: Bundle?) {',\n ' super.onCreate(savedInstanceState)',\n ' }',\n ];\n\n mainActivity = mergeContents({\n src: mainActivity,\n // insert just below super.onCreate\n anchor: isJava\n ? /(?<=public\\s+class\\s+.*\\s+extends\\s+.*\\s+{.*$)/m\n : /(?<=class\\s+.*\\s+:\\s+.*\\s+{.*$)/m,\n offset: 1,\n comment: '//',\n tag: 'expo-splash-screen-mainActivity-onCreate',\n newSrc: onCreateBlock.join('\\n'),\n }).contents;\n }\n\n // Remove our generated code safely...\n mainActivity = removeContents({\n src: mainActivity,\n tag: SHOW_SPLASH_ID,\n }).contents;\n\n // Remove code from `@expo/configure-splash-screen`\n mainActivity = mainActivity\n .split('\\n')\n .filter(line => {\n return !/SplashScreen\\.show\\(this,\\s?SplashScreenImageResizeMode\\./.test(line);\n })\n .join('\\n');\n\n // Reapply generated code.\n mainActivity = mergeContents({\n src: mainActivity,\n // insert just below super.onCreate\n anchor: /(?<=^.*super\\.onCreate.*$)/m,\n offset: 1,\n comment: '//',\n tag: SHOW_SPLASH_ID,\n newSrc: ` SplashScreen.show(this, SplashScreenImageResizeMode.${resizeMode.toUpperCase()}, ReactRootView${\n isJava ? '.class' : '::class.java'\n }, ${statusBarTranslucent})${LE}`,\n }).contents;\n\n // TODO: Remove old `SplashScreen.show`\n\n return mainActivity;\n}\n"],"file":"withAndroidSplashLegacyMainActivity.js"}
|
|
@@ -16,6 +16,16 @@ function _configPlugins() {
|
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
function _imageUtils() {
|
|
20
|
+
const data = require("@expo/image-utils");
|
|
21
|
+
|
|
22
|
+
_imageUtils = function () {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
function _debug() {
|
|
20
30
|
const data = _interopRequireDefault(require("debug"));
|
|
21
31
|
|
|
@@ -74,6 +84,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
74
84
|
|
|
75
85
|
// @ts-ignore
|
|
76
86
|
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios:assets');
|
|
87
|
+
const IMAGE_CACHE_NAME = 'splash-ios';
|
|
77
88
|
const IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';
|
|
78
89
|
const BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';
|
|
79
90
|
const PNG_FILENAME = 'image.png';
|
|
@@ -89,14 +100,15 @@ const withIosSplashAssets = (config, splash) => {
|
|
|
89
100
|
return (0, _configPlugins().withDangerousMod)(config, ['ios', async config => {
|
|
90
101
|
var _splash$dark, _splash$dark2;
|
|
91
102
|
|
|
92
|
-
const
|
|
103
|
+
const iosNamedProjectRoot = _configPlugins().IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);
|
|
93
104
|
|
|
94
105
|
await createSplashScreenBackgroundImageAsync({
|
|
95
|
-
iosNamedProjectRoot
|
|
106
|
+
iosNamedProjectRoot,
|
|
96
107
|
splash
|
|
97
108
|
});
|
|
98
109
|
await configureImageAssets({
|
|
99
|
-
|
|
110
|
+
projectRoot: config.modRequest.projectRoot,
|
|
111
|
+
iosNamedProjectRoot,
|
|
100
112
|
image: splash.image,
|
|
101
113
|
darkImage: (_splash$dark = splash.dark) === null || _splash$dark === void 0 ? void 0 : _splash$dark.image,
|
|
102
114
|
tabletImage: splash.tabletImage,
|
|
@@ -113,13 +125,14 @@ const withIosSplashAssets = (config, splash) => {
|
|
|
113
125
|
exports.withIosSplashAssets = withIosSplashAssets;
|
|
114
126
|
|
|
115
127
|
async function configureImageAssets({
|
|
116
|
-
|
|
128
|
+
projectRoot,
|
|
129
|
+
iosNamedProjectRoot,
|
|
117
130
|
image,
|
|
118
131
|
darkImage,
|
|
119
132
|
tabletImage,
|
|
120
133
|
darkTabletImage
|
|
121
134
|
}) {
|
|
122
|
-
const imageSetPath = path().resolve(
|
|
135
|
+
const imageSetPath = path().resolve(iosNamedProjectRoot, IMAGESET_PATH); // ensure old SplashScreen imageSet is removed
|
|
123
136
|
|
|
124
137
|
await _fsExtra().default.remove(imageSetPath);
|
|
125
138
|
|
|
@@ -135,7 +148,8 @@ async function configureImageAssets({
|
|
|
135
148
|
darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null
|
|
136
149
|
});
|
|
137
150
|
await copyImageFiles({
|
|
138
|
-
|
|
151
|
+
projectRoot,
|
|
152
|
+
iosNamedProjectRoot,
|
|
139
153
|
image,
|
|
140
154
|
darkImage,
|
|
141
155
|
tabletImage,
|
|
@@ -149,7 +163,7 @@ async function createPngFileAsync(color, filePath) {
|
|
|
149
163
|
}
|
|
150
164
|
|
|
151
165
|
async function createBackgroundImagesAsync({
|
|
152
|
-
|
|
166
|
+
iosNamedProjectRoot,
|
|
153
167
|
color,
|
|
154
168
|
darkColor,
|
|
155
169
|
tabletColor,
|
|
@@ -157,7 +171,7 @@ async function createBackgroundImagesAsync({
|
|
|
157
171
|
}) {
|
|
158
172
|
await generateImagesAssetsAsync({
|
|
159
173
|
async generateImageAsset(item, fileName) {
|
|
160
|
-
await createPngFileAsync(item, path().resolve(
|
|
174
|
+
await createPngFileAsync(item, path().resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH, fileName));
|
|
161
175
|
},
|
|
162
176
|
|
|
163
177
|
anyItem: color,
|
|
@@ -168,7 +182,8 @@ async function createBackgroundImagesAsync({
|
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
async function copyImageFiles({
|
|
171
|
-
|
|
185
|
+
projectRoot,
|
|
186
|
+
iosNamedProjectRoot,
|
|
172
187
|
image,
|
|
173
188
|
darkImage,
|
|
174
189
|
tabletImage,
|
|
@@ -176,7 +191,19 @@ async function copyImageFiles({
|
|
|
176
191
|
}) {
|
|
177
192
|
await generateImagesAssetsAsync({
|
|
178
193
|
async generateImageAsset(item, fileName) {
|
|
179
|
-
|
|
194
|
+
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
195
|
+
// this method also supports remote URLs and using the global sharp instance.
|
|
196
|
+
const {
|
|
197
|
+
source
|
|
198
|
+
} = await (0, _imageUtils().generateImageAsync)({
|
|
199
|
+
projectRoot,
|
|
200
|
+
cacheType: IMAGE_CACHE_NAME
|
|
201
|
+
}, {
|
|
202
|
+
src: item
|
|
203
|
+
}); // Write image buffer to the file system.
|
|
204
|
+
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
|
|
205
|
+
|
|
206
|
+
await _fsExtra().default.writeFile(path().resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);
|
|
180
207
|
},
|
|
181
208
|
|
|
182
209
|
anyItem: image,
|
|
@@ -212,7 +239,7 @@ async function createSplashScreenBackgroundImageAsync({
|
|
|
212
239
|
await _fsExtra().default.remove(imagesetPath);
|
|
213
240
|
await _fsExtra().default.ensureDir(imagesetPath);
|
|
214
241
|
await createBackgroundImagesAsync({
|
|
215
|
-
|
|
242
|
+
iosNamedProjectRoot,
|
|
216
243
|
color,
|
|
217
244
|
darkColor: darkColor ? darkColor : null,
|
|
218
245
|
tabletColor: tabletColor ? tabletColor : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"names":["debug","IMAGESET_PATH","BACKGROUND_IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","projectPath","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","createSplashScreenBackgroundImageAsync","iosNamedProjectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","createPngFileAsync","color","filePath","png","Jimp","writeAsync","createBackgroundImagesAsync","darkColor","tabletColor","darkTabletColor","generateImagesAssetsAsync","generateImageAsset","item","fileName","anyItem","darkItem","tabletItem","darkTabletItem","copyFile","items","filter","Promise","all","map","backgroundColor","tabletBackgroundColor","imagesetPath","join","ensureDir","darkAppearances","appearance","value","buildContentsJsonImages","idiom","filename","scale","appearances","undefined","Boolean","images"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAJA;AAYA,MAAMA,KAAK,GAAG,sBAAM,oDAAN,CAAd;AAEA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Ae,IACb,6CAAuB;AACrB0C,IAAAA,KAAK,EAAE,MADc;AAErBG,IAAAA,WAAW,EAAEP,eAFQ;AAGrBK,IAAAA,QAAQ,EAAE3C,eAAF,aAAEA,eAAF,cAAEA,eAAF,GAAqB8C,SAHR;AAIrBF,IAAAA,KAAK,EAAE;AAJc,GAAvB,CAjDG,EAuDL5C,eAAe,IACb,6CAAuB;AACrB0C,IAAAA,KAAK,EAAE,MADc;AAErBG,IAAAA,WAAW,EAAEP,eAFQ;AAGrBM,IAAAA,KAAK,EAAE;AAHc,GAAvB,CAxDG,EA6DLf,MA7DK,CA6DEkB,OA7DF,CAAP;AA8DD;;AAED,eAAezC,0BAAf,CAA0C;AACxCC,EAAAA,SADwC;AAExCX,EAAAA,KAFwC;AAGxCC,EAAAA,SAHwC;AAIxCE,EAAAA,WAJwC;AAKxCC,EAAAA;AALwC,CAA1C,EAYG;AACD,QAAMgD,MAAM,GAAGP,uBAAuB,CAAC;AAAE7C,IAAAA,KAAF;AAASC,IAAAA,SAAT;AAAoBE,IAAAA,WAApB;AAAiCC,IAAAA;AAAjC,GAAD,CAAtC;AAEAvB,EAAAA,KAAK,CAAE,uBAAF,EAA0B8B,SAA1B,CAAL;AACA9B,EAAAA,KAAK,CAAE,aAAF,EAAgBuE,MAAhB,CAAL;AACA,QAAM,6CAAuBzC,SAAvB,EAAkC;AAAEyC,IAAAA;AAAF,GAAlC,CAAN;AACD","sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport Jimp from 'jimp-compact';\nimport * as path from 'path';\n\nimport {\n ContentsJsonImage,\n ContentsJsonImageAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';\nconst BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';\nconst PNG_FILENAME = 'image.png';\nconst DARK_PNG_FILENAME = 'dark_image.png';\nconst TABLET_PNG_FILENAME = 'tablet_image.png';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image.png';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const projectPath = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot: projectPath,\n splash,\n });\n\n await configureImageAssets({\n projectPath,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectPath: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n}) {\n const imageSetPath = path.resolve(projectPath, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({ projectPath, image, darkImage, tabletImage, darkTabletImage });\n}\n\nasync function createPngFileAsync(color: string, filePath: string) {\n const png = new Jimp(1, 1, color);\n return png.writeAsync(filePath);\n}\n\nasync function createBackgroundImagesAsync({\n projectPath,\n color,\n darkColor,\n tabletColor,\n darkTabletColor,\n}: {\n projectPath: string;\n color: string;\n darkColor: string | null;\n tabletColor: string | null;\n darkTabletColor: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await createPngFileAsync(item, path.resolve(projectPath, BACKGROUND_IMAGESET_PATH, fileName));\n },\n anyItem: color,\n darkItem: darkColor,\n tabletItem: tabletColor,\n darkTabletItem: darkTabletColor,\n });\n}\n\nasync function copyImageFiles({\n projectPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectPath: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await fs.copyFile(item, path.resolve(projectPath, IMAGESET_PATH, fileName));\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = ([\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown) as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nasync function createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n}: {\n // Something like projectRoot/ios/MyApp/\n iosNamedProjectRoot: string;\n splash: IOSSplashConfig;\n}) {\n const color = splash.backgroundColor;\n const darkColor = splash.dark?.backgroundColor;\n const tabletColor = splash.tabletBackgroundColor;\n const darkTabletColor = splash.dark?.tabletBackgroundColor;\n\n const imagesetPath = path.join(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH);\n // Ensure the Images.xcassets/... path exists\n await fs.remove(imagesetPath);\n await fs.ensureDir(imagesetPath);\n\n await createBackgroundImagesAsync({\n projectPath: iosNamedProjectRoot,\n color,\n darkColor: darkColor ? darkColor : null,\n tabletColor: tabletColor ? tabletColor : null,\n darkTabletColor: darkTabletColor ? darkTabletColor : null,\n });\n\n await writeContentsJsonFileAsync({\n assetPath: path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH),\n image: PNG_FILENAME,\n darkImage: darkColor ? DARK_PNG_FILENAME : null,\n tabletImage: tabletColor ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletColor ? DARK_TABLET_PNG_FILENAME : null,\n });\n}\n\nconst darkAppearances: ContentsJsonImageAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonImageAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: image,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n filename: darkImage,\n scale: '1x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: tabletImage,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: darkTabletImage ?? undefined,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"file":"withIosSplashAssets.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"names":["debug","IMAGE_CACHE_NAME","IMAGESET_PATH","BACKGROUND_IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","createSplashScreenBackgroundImageAsync","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","createPngFileAsync","color","filePath","png","Jimp","writeAsync","createBackgroundImagesAsync","darkColor","tabletColor","darkTabletColor","generateImagesAssetsAsync","generateImageAsset","item","fileName","anyItem","darkItem","tabletItem","darkTabletItem","source","cacheType","src","writeFile","items","filter","Promise","all","map","backgroundColor","tabletBackgroundColor","imagesetPath","join","ensureDir","darkAppearances","appearance","value","buildContentsJsonImages","idiom","filename","scale","appearances","undefined","Boolean","images"],"mappings":";;;;;;;;AAAA;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;A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;AAAjC,GAAD,CAAtC;AAEAvB,EAAAA,KAAK,CAAE,uBAAF,EAA0B8B,SAA1B,CAAL;AACA9B,EAAAA,KAAK,CAAE,aAAF,EAAgB0E,MAAhB,CAAL;AACA,QAAM,6CAAuB5C,SAAvB,EAAkC;AAAE4C,IAAAA;AAAF,GAAlC,CAAN;AACD","sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport Jimp from 'jimp-compact';\nimport * as path from 'path';\n\nimport {\n ContentsJsonImage,\n ContentsJsonImageAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';\nconst BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';\nconst PNG_FILENAME = 'image.png';\nconst DARK_PNG_FILENAME = 'dark_image.png';\nconst TABLET_PNG_FILENAME = 'tablet_image.png';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image.png';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n });\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n });\n}\n\nasync function createPngFileAsync(color: string, filePath: string) {\n const png = new Jimp(1, 1, color);\n return png.writeAsync(filePath);\n}\n\nasync function createBackgroundImagesAsync({\n iosNamedProjectRoot,\n color,\n darkColor,\n tabletColor,\n darkTabletColor,\n}: {\n iosNamedProjectRoot: string;\n color: string;\n darkColor: string | null;\n tabletColor: string | null;\n darkTabletColor: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await createPngFileAsync(\n item,\n path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH, fileName)\n );\n },\n anyItem: color,\n darkItem: darkColor,\n tabletItem: tabletColor,\n darkTabletItem: darkTabletColor,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: item,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(path.resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = ([\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown) as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nasync function createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n}: {\n // Something like projectRoot/ios/MyApp/\n iosNamedProjectRoot: string;\n splash: IOSSplashConfig;\n}) {\n const color = splash.backgroundColor;\n const darkColor = splash.dark?.backgroundColor;\n const tabletColor = splash.tabletBackgroundColor;\n const darkTabletColor = splash.dark?.tabletBackgroundColor;\n\n const imagesetPath = path.join(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH);\n // Ensure the Images.xcassets/... path exists\n await fs.remove(imagesetPath);\n await fs.ensureDir(imagesetPath);\n\n await createBackgroundImagesAsync({\n iosNamedProjectRoot,\n color,\n darkColor: darkColor ? darkColor : null,\n tabletColor: tabletColor ? tabletColor : null,\n darkTabletColor: darkTabletColor ? darkTabletColor : null,\n });\n\n await writeContentsJsonFileAsync({\n assetPath: path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH),\n image: PNG_FILENAME,\n darkImage: darkColor ? DARK_PNG_FILENAME : null,\n tabletImage: tabletColor ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletColor ? DARK_TABLET_PNG_FILENAME : null,\n });\n}\n\nconst darkAppearances: ContentsJsonImageAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonImageAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: image,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n filename: darkImage,\n scale: '1x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: tabletImage,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: darkTabletImage ?? undefined,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"file":"withIosSplashAssets.js"}
|
|
@@ -58,8 +58,9 @@ function setSplashInfoPlist(config, infoPlist, splash) {
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
infoPlist.UIUserInterfaceStyle = 'Automatic';
|
|
61
|
-
} else {
|
|
62
|
-
|
|
61
|
+
} else {// NOTE(brentvatne): Commented out this line because it causes https://github.com/expo/expo-cli/issues/3935
|
|
62
|
+
// We should revisit this approach.
|
|
63
|
+
// delete infoPlist.UIUserInterfaceStyle;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
if (splash) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.ts"],"names":["debug","withIosSplashInfoPlist","config","splash","modResults","setSplashInfoPlist","infoPlist","isDarkModeEnabled","dark","image","tabletImage","backgroundColor","tabletBackgroundColor","existing","ios","userInterfaceStyle","WarningAggregator","addWarningIOS","UIUserInterfaceStyle","UILaunchStoryboardName"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAIA,MAAMA,KAAK,GAAG,sBAAM,uDAAN,CAAd;;AAEO,MAAMC,sBAAqD,GAAG,CAACC,MAAD,EAASC,MAAT,KAAoB;AACvF,SAAO,oCAAcD,MAAd,EAAsBA,MAAM,IAAI;AACrCA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,kBAAkB,CAACH,MAAD,EAASA,MAAM,CAACE,UAAhB,EAA4BD,MAA5B,CAAtC;AACA,WAAOD,MAAP;AACD,GAHM,CAAP;AAID,CALM;;;;AAOA,SAASG,kBAAT,CACLH,MADK,EAELI,SAFK,EAGLH,MAHK,EAIM;AAAA;;AACX,QAAMI,iBAAiB,GAAG,CAAC,EACzBJ,MAAM,SAAN,IAAAA,MAAM,WAAN,oBAAAA,MAAM,CAAEK,IAAR,sDAAcC,KAAd,IACAN,MADA,aACAA,MADA,gCACAA,MAAM,CAAEK,IADR,0CACA,cAAcE,WADd,IAEAP,MAFA,aAEAA,MAFA,gCAEAA,MAAM,CAAEK,IAFR,0CAEA,cAAcG,eAFd,IAGAR,MAHA,aAGAA,MAHA,gCAGAA,MAAM,CAAEK,IAHR,0CAGA,cAAcI,qBAJW,CAA3B;AAMAZ,EAAAA,KAAK,CAAE,qBAAF,EAAwBO,iBAAxB,CAAL;;AAEA,MAAIA,iBAAJ,EAAuB;AAAA;;AACrB;AACA;AACA,UAAMM,QAAQ,2CAAGX,MAAM,CAACY,GAAV,gDAAG,YAAYC,kBAAf,yEAAqCb,MAAM,CAACa,kBAA1D,CAHqB,CAIrB;;AACA,QAAIF,QAAQ,IAAIA,QAAQ,KAAK,WAA7B,EAA0C;AACxCG,yCAAkBC,aAAlB,CACE,oBADF,EAEE,qJAFF;AAID,KAVoB,CAWrB;;;AACAX,IAAAA,SAAS,CAACY,oBAAV,GAAiC,WAAjC;AACD,GAbD,MAaO
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.ts"],"names":["debug","withIosSplashInfoPlist","config","splash","modResults","setSplashInfoPlist","infoPlist","isDarkModeEnabled","dark","image","tabletImage","backgroundColor","tabletBackgroundColor","existing","ios","userInterfaceStyle","WarningAggregator","addWarningIOS","UIUserInterfaceStyle","UILaunchStoryboardName"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAIA,MAAMA,KAAK,GAAG,sBAAM,uDAAN,CAAd;;AAEO,MAAMC,sBAAqD,GAAG,CAACC,MAAD,EAASC,MAAT,KAAoB;AAC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cesContent":["import { ConfigPlugin, InfoPlist, WarningAggregator, withInfoPlist } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:infoPlist');\n\nexport const withIosSplashInfoPlist: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n return withInfoPlist(config, config => {\n config.modResults = setSplashInfoPlist(config, config.modResults, splash);\n return config;\n });\n};\n\nexport function setSplashInfoPlist(\n config: ExpoConfig,\n infoPlist: InfoPlist,\n splash: IOSSplashConfig\n): InfoPlist {\n const isDarkModeEnabled = !!(\n splash?.dark?.image ||\n splash?.dark?.tabletImage ||\n splash?.dark?.backgroundColor ||\n splash?.dark?.tabletBackgroundColor\n );\n debug(`isDarkModeEnabled: `, isDarkModeEnabled);\n\n if (isDarkModeEnabled) {\n // IOSConfig.UserInterfaceStyle.getUserInterfaceStyle(config);\n // Determine if the user manually defined the userInterfaceStyle incorrectly\n const existing = config.ios?.userInterfaceStyle ?? config.userInterfaceStyle;\n // Add a warning to prevent the dark mode splash screen from not being shown -- this was learned the hard way.\n if (existing && existing !== 'automatic') {\n WarningAggregator.addWarningIOS(\n 'userInterfaceStyle',\n 'The existing `userInterfaceStyle` property is preventing splash screen from working properly. Please remove it or disable dark mode splash screens.'\n );\n }\n // assigning it to auto anyways, but this is fragile because the order of operations matter now\n infoPlist.UIUserInterfaceStyle = 'Automatic';\n } else {\n // NOTE(brentvatne): Commented out this line because it causes https://github.com/expo/expo-cli/issues/3935\n // We should revisit this approach.\n // delete infoPlist.UIUserInterfaceStyle;\n }\n\n if (splash) {\n // TODO: What to do here ??\n infoPlist.UILaunchStoryboardName = 'SplashScreen';\n } else {\n debug(`Disabling UILaunchStoryboardName`);\n delete infoPlist.UILaunchStoryboardName;\n }\n\n return infoPlist;\n}\n"],"file":"withIosSplashInfoPlist.js"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _createLegacyPlugin() {
|
|
9
|
+
const data = require("../createLegacyPlugin");
|
|
10
|
+
|
|
11
|
+
_createLegacyPlugin = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _withAndroidRootViewBackgroundColor() {
|
|
19
|
+
const data = require("./withAndroidRootViewBackgroundColor");
|
|
20
|
+
|
|
21
|
+
_withAndroidRootViewBackgroundColor = function () {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _withAndroidUserInterfaceStyle() {
|
|
29
|
+
const data = require("./withAndroidUserInterfaceStyle");
|
|
30
|
+
|
|
31
|
+
_withAndroidUserInterfaceStyle = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _withIosRootViewBackgroundColor() {
|
|
39
|
+
const data = require("./withIosRootViewBackgroundColor");
|
|
40
|
+
|
|
41
|
+
_withIosRootViewBackgroundColor = function () {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _withIosUserInterfaceStyle() {
|
|
49
|
+
const data = require("./withIosUserInterfaceStyle");
|
|
50
|
+
|
|
51
|
+
_withIosUserInterfaceStyle = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var _default = (0, _createLegacyPlugin().createLegacyPlugin)({
|
|
59
|
+
packageName: 'expo-system-ui',
|
|
60
|
+
fallback: [_withAndroidRootViewBackgroundColor().withAndroidRootViewBackgroundColor, _withIosRootViewBackgroundColor().withIosRootViewBackgroundColor, _withAndroidUserInterfaceStyle().withAndroidUserInterfaceStyle, _withIosUserInterfaceStyle().withIosUserInterfaceStyle]
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
exports.default = _default;
|
|
64
|
+
//# sourceMappingURL=expo-system-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-system-ui/expo-system-ui.ts"],"names":["packageName","fallback","withAndroidRootViewBackgroundColor","withIosRootViewBackgroundColor","withAndroidUserInterfaceStyle","withIosUserInterfaceStyle"],"mappings":";;;;;;;AAAA;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;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAEe,8CAAmB;AAChCA,EAAAA,WAAW,EAAE,gBADmB;AAEhCC,EAAAA,QAAQ,EAAE,CACRC,wEADQ,EAERC,gEAFQ,EAGRC,8DAHQ,EAIRC,sDAJQ;AAFsB,CAAnB,C","sourcesContent":["import { createLegacyPlugin } from '../createLegacyPlugin';\nimport { withAndroidRootViewBackgroundColor } from './withAndroidRootViewBackgroundColor';\nimport { withAndroidUserInterfaceStyle } from './withAndroidUserInterfaceStyle';\nimport { withIosRootViewBackgroundColor } from './withIosRootViewBackgroundColor';\nimport { withIosUserInterfaceStyle } from './withIosUserInterfaceStyle';\n\nexport default createLegacyPlugin({\n packageName: 'expo-system-ui',\n fallback: [\n withAndroidRootViewBackgroundColor,\n withIosRootViewBackgroundColor,\n withAndroidUserInterfaceStyle,\n withIosUserInterfaceStyle,\n ],\n});\n"],"file":"expo-system-ui.js"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { ExpoConfig } from '@expo/config-types';
|
|
3
|
+
export declare const withAndroidRootViewBackgroundColor: ConfigPlugin;
|
|
4
|
+
export declare const withRootViewBackgroundColorColors: ConfigPlugin;
|
|
5
|
+
export declare const withRootViewBackgroundColorStyles: ConfigPlugin;
|
|
6
|
+
export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'android' | 'backgroundColor'>): string | null;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
|
|
7
|
+
exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withAndroidRootViewBackgroundColor = void 0;
|
|
8
|
+
|
|
9
|
+
function _configPlugins() {
|
|
10
|
+
const data = require("@expo/config-plugins");
|
|
11
|
+
|
|
12
|
+
_configPlugins = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
assignColorValue
|
|
21
|
+
} = _configPlugins().AndroidConfig.Colors;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
assignStylesValue,
|
|
25
|
+
getAppThemeLightNoActionBarGroup
|
|
26
|
+
} = _configPlugins().AndroidConfig.Styles;
|
|
27
|
+
|
|
28
|
+
const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
|
|
29
|
+
const WINDOW_BACKGROUND_COLOR = 'activityBackground';
|
|
30
|
+
|
|
31
|
+
const withAndroidRootViewBackgroundColor = config => {
|
|
32
|
+
config = withRootViewBackgroundColorColors(config);
|
|
33
|
+
config = withRootViewBackgroundColorStyles(config);
|
|
34
|
+
return config;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.withAndroidRootViewBackgroundColor = withAndroidRootViewBackgroundColor;
|
|
38
|
+
|
|
39
|
+
const withRootViewBackgroundColorColors = config => {
|
|
40
|
+
return (0, _configPlugins().withAndroidColors)(config, async config => {
|
|
41
|
+
config.modResults = assignColorValue(config.modResults, {
|
|
42
|
+
value: getRootViewBackgroundColor(config),
|
|
43
|
+
name: WINDOW_BACKGROUND_COLOR
|
|
44
|
+
});
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
|
|
50
|
+
|
|
51
|
+
const withRootViewBackgroundColorStyles = config => {
|
|
52
|
+
return (0, _configPlugins().withAndroidStyles)(config, async config => {
|
|
53
|
+
config.modResults = assignStylesValue(config.modResults, {
|
|
54
|
+
add: !!getRootViewBackgroundColor(config),
|
|
55
|
+
parent: getAppThemeLightNoActionBarGroup(),
|
|
56
|
+
name: ANDROID_WINDOW_BACKGROUND,
|
|
57
|
+
value: `@color/${WINDOW_BACKGROUND_COLOR}`
|
|
58
|
+
});
|
|
59
|
+
return config;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
|
|
64
|
+
|
|
65
|
+
function getRootViewBackgroundColor(config) {
|
|
66
|
+
var _config$android;
|
|
67
|
+
|
|
68
|
+
return ((_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.backgroundColor) || config.backgroundColor || null;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=withAndroidRootViewBackgroundColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.ts"],"names":["assignColorValue","AndroidConfig","Colors","assignStylesValue","getAppThemeLightNoActionBarGroup","Styles","ANDROID_WINDOW_BACKGROUND","WINDOW_BACKGROUND_COLOR","withAndroidRootViewBackgroundColor","config","withRootViewBackgroundColorColors","withRootViewBackgroundColorStyles","modResults","value","getRootViewBackgroundColor","name","add","parent","android","backgroundColor"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAuBC,+BAAcC,MAA3C;;AACA,MAAM;AAAEC,EAAAA,iBAAF;AAAqBC,EAAAA;AAArB,IAA0DH,+BAAcI,MAA9E;;AAEA,MAAMC,yBAAyB,GAAG,0BAAlC;AACA,MAAMC,uBAAuB,GAAG,oBAAhC;;AAEO,MAAMC,kCAAgD,GAAGC,MAAM,IAAI;AACxEA,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,wCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoBZ,gBAAgB,CAACS,MAAM,CAACG,UAAR,EAAoB;AACtDC,MAAAA,KAAK,EAAEC,0BAA0B,CAACL,MAAD,CADqB;AAEtDM,MAAAA,IAAI,EAAER;AAFgD,KAApB,CAApC;AAIA,WAAOE,MAAP;AACD,GANM,CAAP;AAOD,CARM;;;;AAUA,MAAME,iCAA+C,GAAGF,MAAM,IAAI;AACvE,SAAO,wCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoBT,iBAAiB,CAACM,MAAM,CAACG,UAAR,EAAoB;AACvDI,MAAAA,GAAG,EAAE,CAAC,CAACF,0BAA0B,CAACL,MAAD,CADsB;AAEvDQ,MAAAA,MAAM,EAAEb,gCAAgC,EAFe;AAGvDW,MAAAA,IAAI,EAAET,yBAHiD;AAIvDO,MAAAA,KAAK,EAAG,UAASN,uBAAwB;AAJc,KAApB,CAArC;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 {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidStyles,\n} from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nconst { assignColorValue } = AndroidConfig.Colors;\nconst { assignStylesValue, getAppThemeLightNoActionBarGroup } = AndroidConfig.Styles;\n\nconst ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';\nconst WINDOW_BACKGROUND_COLOR = 'activityBackground';\n\nexport const withAndroidRootViewBackgroundColor: 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":"withAndroidRootViewBackgroundColor.js"}
|