[Cleanup] Small tidying

This commit is contained in:
Beef 2022-10-19 07:58:32 +01:00
parent 1679b51889
commit b4f5bdc996
6 changed files with 17 additions and 10 deletions

View file

@ -5,6 +5,7 @@ import * as common from "@metro/common";
import initSettings from "./ui/settings"; import initSettings from "./ui/settings";
console.log("Hello from Vendetta!"); console.log("Hello from Vendetta!");
let erroredOnLoad = false;
try { try {
initSettings(); initSettings();
@ -14,8 +15,9 @@ try {
metro: { ...metro, common: common }, metro: { ...metro, common: common },
logger: logger, logger: logger,
}; };
logger.log("Vendetta is ready!");
} catch (e: Error | any) { } catch (e: Error | any) {
erroredOnLoad = true;
alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`); alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`);
} }
if (!erroredOnLoad) logger.log("Vendetta is ready!");

4
src/ui/components.ts Normal file
View file

@ -0,0 +1,4 @@
import { findByProps } from "@metro/filters";
// TODO: Type individual props
export const Forms = findByProps("FormSection");

View file

@ -1,8 +1,8 @@
import { React, ReactNative as RN } from "@metro/common"; import { React, ReactNative as RN } from "@metro/common";
import { findByProps } from "@metro/filters"; import { Forms } from "@ui/components";
import Version from "./Version"; import Version from "./Version";
const { FormRow, FormSection, FormText } = findByProps("FormSection"); const { FormRow, FormSection } = Forms;
const hermesProps = window.HermesInternal.getRuntimeProperties(); const hermesProps = window.HermesInternal.getRuntimeProperties();
const rnVer = RN.Platform.constants.reactNativeVersion; const rnVer = RN.Platform.constants.reactNativeVersion;

View file

@ -1,7 +1,7 @@
import { React } from "@metro/common"; import { React } from "@metro/common";
import { findByProps } from "@metro/filters"; import { Forms } from "@ui/components";
const { FormRow, FormSection } = findByProps("FormSection"); const { FormRow, FormSection } = Forms;
interface SettingsSectionProps { interface SettingsSectionProps {
navigation: any; navigation: any;

View file

@ -1,12 +1,12 @@
import { React } from "@metro/common"; import { React } from "@metro/common";
import { findByProps } from "@metro/filters"; import { Forms } from "@ui/components";
interface VersionProps { interface VersionProps {
label: string; label: string;
version: string version: string
} }
const { FormRow, FormText } = findByProps("FormSection"); const { FormRow, FormText } = Forms;
export default function Version({ label, version }: VersionProps) { export default function Version({ label, version }: VersionProps) {
return ( return (

View file

@ -17,7 +17,8 @@
"@types": ["src/def.d.ts"], "@types": ["src/def.d.ts"],
"@lib/*": ["src/lib/*"], "@lib/*": ["src/lib/*"],
"@metro/*": ["src/lib/metro/*"], "@metro/*": ["src/lib/metro/*"],
"@utils/*": ["src/lib/utils/*"] "@utils/*": ["src/lib/utils/*"],
"@ui/*": ["src/ui/*"]
} }
} }
} }