fix: coloring status bar to black

I dunno if itll fix the issue, but I hope it does

taken from Firecord tho, so AI slop
This commit is contained in:
kmmiio99o 2026-01-23 20:16:27 +01:00
parent 554f50e235
commit 7e8cdfe042
No known key found for this signature in database
GPG key ID: 163FE39F7772D2EC
2 changed files with 26 additions and 29 deletions

View file

@ -3,6 +3,7 @@ import patchDefinitionAndResolver from "./patches/resolver";
import patchStorage from "./patches/storage";
import { ColorManifest } from "./types";
import { updateBunnyColor } from "./updater";
import fixStatusBar from "./statusbar";
/** @internal */
export default function initColors(manifest: ColorManifest | null) {
@ -11,8 +12,9 @@ export default function initColors(manifest: ColorManifest | null) {
const patches = [
patchStorage(),
patchDefinitionAndResolver(),
patchChatBackground()
patchChatBackground(),
fixStatusBar()
];
return () => patches.forEach(p => p());
}
return () => patches.forEach(p => p && (typeof p === "function" ? p() : null));
}

View file

@ -1,4 +1,4 @@
import { StatusBar, TextInput, Platform } from "react-native";
import { StatusBar, Platform } from "react-native";
import { findByStoreNameLazy } from "@metro/wrappers";
import { _colorRef } from "./updater";
@ -7,15 +7,8 @@ const ThemeStore = findByStoreNameLazy("ThemeStore");
function getBarStyle() {
// Check for custom theme
const custom = _colorRef.current;
if (custom) {
// Bunny theme (spec 3)
if (custom.spec === 3 && custom.reference) {
return custom.reference === "light" ? "dark-content" : "light-content";
}
// Vendetta theme (spec 2)
if (custom.spec === 2 && custom.reference) {
return custom.reference === "light" ? "dark-content" : "light-content";
}
if (custom?.reference) {
return custom.reference === "light" ? "dark-content" : "light-content";
}
// Fallback to Discord theme string
@ -25,33 +18,35 @@ function getBarStyle() {
return (lowerTheme.includes("dark") || lowerTheme.includes("midnight")) ? "light-content" : "dark-content";
}
return "dark-content";
return "light-content";
}
export default function fixStatusBar() {
function applyStatusBar() {
const style = getBarStyle();
StatusBar.setBarStyle(style, true);
if (Platform.OS == "android") {
if (Platform.OS === "android") {
StatusBar.setTranslucent?.(true);
StatusBar.setBackgroundColor?.("#00000000", true);
}
}
if (Platform.OS === "android") {
const origSetBarStyle = StatusBar.setBarStyle;
StatusBar.setBarStyle = function (_style: any, ...args: any[]) {
return origSetBarStyle.call(this, getBarStyle(), ...args);
};
}
if (Platform.OS == "ios") {
function applyStatusBar() {
const style = getBarStyle();
StatusBar.setBarStyle(style, true);
}
const unsubscribe = ThemeStore?.addChangeListener?.(applyStatusBar);
const unsubscribe = ThemeStore?.addChangeListener?.(applyStatusBar);
applyStatusBar();
StatusBar.setBarStyle(getBarStyle());
let delay = 200;
for (let i = 0; i < 5; i++, delay *= 2) {
setTimeout(applyStatusBar, delay);
}
return unsubscribe;
let delay = 200;
for (let i = 0; i < 5; i++, delay *= 2) {
setTimeout(applyStatusBar, delay);
}
return unsubscribe;
}