diff --git a/src/index.ts b/src/index.ts index 010341e..614b9dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import * as common from "@metro/common"; import initSettings from "./ui/settings"; console.log("Hello from Vendetta!"); +let erroredOnLoad = false; try { initSettings(); @@ -14,8 +15,9 @@ try { metro: { ...metro, common: common }, logger: logger, }; - - logger.log("Vendetta is ready!"); } catch (e: Error | any) { + erroredOnLoad = true; alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`); -} \ No newline at end of file +} + +if (!erroredOnLoad) logger.log("Vendetta is ready!"); \ No newline at end of file diff --git a/src/ui/components.ts b/src/ui/components.ts new file mode 100644 index 0000000..eb64fbb --- /dev/null +++ b/src/ui/components.ts @@ -0,0 +1,4 @@ +import { findByProps } from "@metro/filters"; + +// TODO: Type individual props +export const Forms = findByProps("FormSection"); \ No newline at end of file diff --git a/src/ui/settings/components/Settings.tsx b/src/ui/settings/components/Settings.tsx index c5f7e9f..89a9b91 100644 --- a/src/ui/settings/components/Settings.tsx +++ b/src/ui/settings/components/Settings.tsx @@ -1,8 +1,8 @@ import { React, ReactNative as RN } from "@metro/common"; -import { findByProps } from "@metro/filters"; +import { Forms } from "@ui/components"; import Version from "./Version"; -const { FormRow, FormSection, FormText } = findByProps("FormSection"); +const { FormRow, FormSection } = Forms; const hermesProps = window.HermesInternal.getRuntimeProperties(); const rnVer = RN.Platform.constants.reactNativeVersion; diff --git a/src/ui/settings/components/SettingsSection.tsx b/src/ui/settings/components/SettingsSection.tsx index 0818822..2792f63 100644 --- a/src/ui/settings/components/SettingsSection.tsx +++ b/src/ui/settings/components/SettingsSection.tsx @@ -1,7 +1,7 @@ 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 { navigation: any; diff --git a/src/ui/settings/components/Version.tsx b/src/ui/settings/components/Version.tsx index a5d5ad9..32e81c6 100644 --- a/src/ui/settings/components/Version.tsx +++ b/src/ui/settings/components/Version.tsx @@ -1,12 +1,12 @@ import { React } from "@metro/common"; -import { findByProps } from "@metro/filters"; +import { Forms } from "@ui/components"; interface VersionProps { label: string; version: string } -const { FormRow, FormText } = findByProps("FormSection"); +const { FormRow, FormText } = Forms; export default function Version({ label, version }: VersionProps) { return ( diff --git a/tsconfig.json b/tsconfig.json index 339e481..bed15f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,8 @@ "@types": ["src/def.d.ts"], "@lib/*": ["src/lib/*"], "@metro/*": ["src/lib/metro/*"], - "@utils/*": ["src/lib/utils/*"] + "@utils/*": ["src/lib/utils/*"], + "@ui/*": ["src/ui/*"] } } }