Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix(mobile): android dark mode bug

daniel31x1359ef7baeeb9f
diff --git a/apps/mobile/app.json b/apps/mobile/app.json
index 516ece6d..bf89677e 100644
--- a/apps/mobile/app.json
+++ b/apps/mobile/app.json
@@ -36,7 +36,8 @@
}
],
"expo-secure-store",
- "expo-share-intent"
+ "expo-share-intent",
+ "./plugins/with-daynight-transparent-nav"
],
"experiments": {
"typedRoutes": true
diff --git a/apps/mobile/plugins/with-daynight-transparent-nav.js b/apps/mobile/plugins/with-daynight-transparent-nav.js
new file mode 100644
index 00000000..2b3f634d
--- /dev/null
+++ b/apps/mobile/plugins/with-daynight-transparent-nav.js
@@ -0,0 +1,43 @@
+const { withAndroidStyles } = require("@expo/config-plugins");
+function mutateStylesXml(xml) {
+ const styles = xml.resources?.style ?? [];
+ let appTheme = styles.find((s) => s.$?.name === "AppTheme");
+ if (!appTheme) {
+ appTheme = {
+ $: { name: "AppTheme", parent: "Theme.AppCompat.DayNight.NoActionBar" },
+ item: [],
+ };
+ styles.push(appTheme);
+ }
+
+ appTheme.$ = appTheme.$ || {};
+ appTheme.$.parent = "Theme.AppCompat.DayNight.NoActionBar";
+
+ appTheme.item = appTheme.item ?? [];
+
+ appTheme.item = appTheme.item.filter(
+ (i) => i?.$?.name !== "android:textColor"
+ );
+
+ const navItem = appTheme.item.find(
+ (i) => i.$?.name === "android:navigationBarColor"
+ );
+ if (navItem) {
+ navItem._ = "@android:color/transparent";
+ } else {
+ appTheme.item.push({
+ $: { name: "android:navigationBarColor" },
+ _: "@android:color/transparent",
+ });
+ }
+
+ xml.resources.style = styles;
+ return xml;
+}
+
+module.exports = function withDayNightTransparentNav(config) {
+ return withAndroidStyles(config, (c) => {
+ c.modResults = mutateStylesXml(c.modResults);
+ return c;
+ });
+};
diff --git a/apps/mobile/tailwind.config.js b/apps/mobile/tailwind.config.js
index 52136092..9e521ad0 100644
--- a/apps/mobile/tailwind.config.js
+++ b/apps/mobile/tailwind.config.js
@@ -13,6 +13,7 @@ const hexToRgb = (hex) => {
module.exports = {
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
+ darkMode: "media",
theme: {
extend: {
colors: Object.fromEntries(