From a770f5635b549f2a87ffeaedd031dfe8e37b58c8 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 22 Apr 2025 18:16:50 +0200 Subject: Edge to edge support (#7497) --- plugins/withAndroidDayNightThemePlugin.js | 27 +++++++++++++++++++++ ...ndroidSplashScreenStatusBarTranslucentPlugin.js | 28 ---------------------- plugins/withAndroidStylesAccentColorPlugin.js | 2 +- 3 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 plugins/withAndroidDayNightThemePlugin.js delete mode 100644 plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js (limited to 'plugins') diff --git a/plugins/withAndroidDayNightThemePlugin.js b/plugins/withAndroidDayNightThemePlugin.js new file mode 100644 index 000000000..d9bc1b211 --- /dev/null +++ b/plugins/withAndroidDayNightThemePlugin.js @@ -0,0 +1,27 @@ +// Based on https://github.com/expo/expo/pull/33957 +// Could be removed once the app has been updated to Expo 53 +const {withAndroidStyles} = require('@expo/config-plugins') + +module.exports = function withAndroidDayNightThemePlugin(appConfig) { + const cleanupList = new Set([ + 'colorPrimary', + 'android:editTextBackground', + 'android:textColor', + 'android:editTextStyle', + ]) + + return withAndroidStyles(appConfig, config => { + config.modResults.resources.style = config.modResults.resources.style + ?.map(style => { + if (style.$.name === 'AppTheme' && style.item != null) { + style.item = style.item.filter(item => !cleanupList.has(item.$.name)) + } + return style + }) + .filter(style => { + return style.$.name !== 'ResetEditText' + }) + + return config + }) +} diff --git a/plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js b/plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js deleted file mode 100644 index 704ead054..000000000 --- a/plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js +++ /dev/null @@ -1,28 +0,0 @@ -const {withStringsXml, AndroidConfig} = require('@expo/config-plugins') - -module.exports = function withAndroidSplashScreenStatusBarTranslucentPlugin( - appConfig, -) { - return withStringsXml(appConfig, function (decoratedAppConfig) { - try { - decoratedAppConfig.modResults = AndroidConfig.Strings.setStringItem( - [ - { - _: 'true', - $: { - name: 'expo_splash_screen_status_bar_translucent', - translatable: 'false', - }, - }, - ], - decoratedAppConfig.modResults, - ) - } catch (e) { - console.error( - `withAndroidSplashScreenStatusBarTranslucentPlugin failed`, - e, - ) - } - return decoratedAppConfig - }) -} diff --git a/plugins/withAndroidStylesAccentColorPlugin.js b/plugins/withAndroidStylesAccentColorPlugin.js index c45553788..51dd44f35 100644 --- a/plugins/withAndroidStylesAccentColorPlugin.js +++ b/plugins/withAndroidStylesAccentColorPlugin.js @@ -12,7 +12,7 @@ module.exports = function withAndroidStylesAccentColorPlugin(appConfig) { decoratedAppConfig.modResults, { add: true, - parent: AndroidConfig.Styles.getAppThemeLightNoActionBarGroup(), + parent: AndroidConfig.Styles.getAppThemeGroup(), name: 'colorAccent', value: '@color/colorPrimary', }, -- cgit 1.4.1