whoops
This commit is contained in:
parent
8c8baaed5c
commit
100d8967ba
3 changed files with 12 additions and 12 deletions
|
|
@ -26,7 +26,7 @@ const { useSafeAreaInsets } = findByProps("useSafeAreaInsets");
|
|||
interface Screen {
|
||||
[index: string]: any;
|
||||
key: string;
|
||||
title: string;
|
||||
title: () => string;
|
||||
icon?: string;
|
||||
shouldRender?: () => boolean;
|
||||
options?: Record<string, any>;
|
||||
|
|
@ -48,13 +48,13 @@ const keyMap = (screens: Screen[], data: string | ((s: Screen) => any) | null) =
|
|||
export const getScreens = (): Screen[] => [
|
||||
{
|
||||
key: "VendettaSettings",
|
||||
title: Strings.GENERAL,
|
||||
title: () => Strings.GENERAL,
|
||||
icon: "settings",
|
||||
render: General,
|
||||
},
|
||||
{
|
||||
key: "VendettaPlugins",
|
||||
title: Strings.PLUGINS,
|
||||
title: () => Strings.PLUGINS,
|
||||
icon: "debug",
|
||||
options: {
|
||||
headerRight: () => (
|
||||
|
|
@ -81,7 +81,7 @@ export const getScreens = (): Screen[] => [
|
|||
},
|
||||
{
|
||||
key: "VendettaThemes",
|
||||
title: Strings.THEMES,
|
||||
title: () => Strings.THEMES,
|
||||
icon: "ic_theme_24px",
|
||||
// TODO: bad
|
||||
shouldRender: () => isThemeSupported(),
|
||||
|
|
@ -92,14 +92,14 @@ export const getScreens = (): Screen[] => [
|
|||
},
|
||||
{
|
||||
key: "VendettaDeveloper",
|
||||
title: Strings.DEVELOPER,
|
||||
title: () => Strings.DEVELOPER,
|
||||
icon: "ic_progress_wrench_24px",
|
||||
shouldRender: () => settings.developerSettings ?? false,
|
||||
render: Developer,
|
||||
},
|
||||
{
|
||||
key: "VendettaCustomPage",
|
||||
title: "Vendetta Page",
|
||||
title: () => "Vendetta Page",
|
||||
shouldRender: () => false,
|
||||
render: ({ render: PageView, noErrorBoundary, ...options }: { render: React.ComponentType; noErrorBoundary: boolean; } & Record<string, object>) => {
|
||||
const navigation = NavigationNative.useNavigation();
|
||||
|
|
@ -111,7 +111,7 @@ export const getScreens = (): Screen[] => [
|
|||
];
|
||||
|
||||
export const getPanelsScreens = () => keyMap(getScreens(), s => ({
|
||||
title: s.title,
|
||||
title: s.title(),
|
||||
render: s.render,
|
||||
...s.options,
|
||||
}));
|
||||
|
|
@ -128,7 +128,7 @@ export const getYouData = () => {
|
|||
// We can't use our keyMap function here since `settings` is an array not an object
|
||||
settings: screens.map(s => s.key)
|
||||
}),
|
||||
titleConfig: keyMap(screens, "title"),
|
||||
titleConfig: keyMap(screens, s => s.title()),
|
||||
relationships: keyMap(screens, null),
|
||||
rendererConfigs: keyMap(screens, s => {
|
||||
const WrappedComponent = React.memo(({ navigation, route }: any) => {
|
||||
|
|
@ -142,7 +142,7 @@ export const getYouData = () => {
|
|||
|
||||
return {
|
||||
type: "route",
|
||||
title: () => s.title,
|
||||
title: s.title,
|
||||
icon: s.icon ? getAssetIDByName(s.icon) : null,
|
||||
usePredicate: s.shouldRender && (() => useProxy(settings) && s.shouldRender!!()),
|
||||
screen: {
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ export const rawColors = (color?.default?.unsafe_rawColors ?? constants?.Colors)
|
|||
const ThemeStore = findByStoreName("ThemeStore");
|
||||
const colorResolver = color.default.internal ??= color.default.meta;
|
||||
|
||||
export function isSemanticColor(sym: Symbol): boolean {
|
||||
export function isSemanticColor(sym: any): boolean {
|
||||
return colorResolver.isSemanticColor(sym);
|
||||
}
|
||||
|
||||
export function resolveSemanticColor(sym: Symbol, theme = ThemeStore.theme): string {
|
||||
export function resolveSemanticColor(sym: any, theme = ThemeStore.theme): string {
|
||||
return colorResolver.resolveSemanticColor(theme, sym);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export function createThemedStyleSheet<T extends StyleSheet.NamedStyles<T>>(shee
|
|||
sheet[key] = new Proxy(StyleSheet.flatten(sheet[key]), {
|
||||
get(target, prop, receiver) {
|
||||
const res = Reflect.get(target, prop, receiver);
|
||||
return typeof res === "symbol" && isSemanticColor(res) ? resolveSemanticColor(res) : res;
|
||||
return isSemanticColor(res) ? resolveSemanticColor(res) : res;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue