about summary refs log tree commit diff
path: root/plugins/withAndroidDayNightThemePlugin.js
diff options
context:
space:
mode:
authorMathieu Acthernoene <zoontek@gmail.com>2025-04-22 18:16:50 +0200
committerGitHub <noreply@github.com>2025-04-22 19:16:50 +0300
commita770f5635b549f2a87ffeaedd031dfe8e37b58c8 (patch)
tree2e935d294227e57b2e81ba79ba96a6a85f268971 /plugins/withAndroidDayNightThemePlugin.js
parent6e80b340c825900524bfe981ba29cfd0c6cf5934 (diff)
downloadvoidsky-a770f5635b549f2a87ffeaedd031dfe8e37b58c8.tar.zst
Edge to edge support (#7497)
Diffstat (limited to 'plugins/withAndroidDayNightThemePlugin.js')
-rw-r--r--plugins/withAndroidDayNightThemePlugin.js27
1 files changed, 27 insertions, 0 deletions
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
+  })
+}