Revenge/src/ui/settings/components/SettingsSection.tsx
Beef fda8e31bb1 [UI > Settings] Complete overhaul, support You tab
You tab support has a few issues, namely:
* Text inputs automatically close the keyboard
* The Developer toggle is not reactive
* Plugins will need to update if they set navigation options in their settings, otherwise an infinite re-render occurs

Co-authored-by: Jack Matthews <jm5112356@gmail.com>
2023-05-21 01:04:53 +01:00

33 lines
No EOL
1.2 KiB
TypeScript

import { NavigationNative } from "@metro/common";
import { useProxy } from "@lib/storage";
import { getAssetIDByName } from "@ui/assets";
import { getScreens } from "@ui/settings/data";
import { ErrorBoundary, Forms } from "@ui/components";
import settings from "@lib/settings";
const { FormRow, FormSection, FormDivider } = Forms;
export default function SettingsSection() {
const navigation = NavigationNative.useNavigation();
useProxy(settings);
const screens = getScreens();
return (
<ErrorBoundary>
<FormSection key="Vendetta" title={`Vendetta${settings.safeMode?.enabled ? " (Safe Mode)" : ""}`}>
{screens.filter(s => s.shouldRender ?? true).map((s, i) => (
<>
<FormRow
label={s.title}
leading={<FormRow.Icon source={getAssetIDByName(s.icon!)} />}
trailing={FormRow.Arrow}
onPress={() => navigation.push(s.key)}
/>
{i !== screens.length - 1 && <FormDivider />}
</>
))}
</FormSection>
</ErrorBoundary>
)
}