diff --git a/src/def.d.ts b/src/def.d.ts index 52378ab..f8bff52 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -27,6 +27,12 @@ interface CodeblockProps { children?: string; } +interface SearchProps { + onChangeText?: (v: string) => void; + placeholder?: string; + style?: _RN.TextStyle; +} + // Helper types for API functions type PropIntellisense

= Record & Record; type PropsFinder = (...props: T[]) => PropIntellisense; @@ -412,7 +418,6 @@ interface VendettaObject { // Discord Forms: PropIntellisense<"Form" | "FormSection">; General: PropIntellisense<"Button" | "Text" | "View">; - Search: _React.ComponentType; Alert: _React.ComponentType; Button: _React.ComponentType & { Looks: any, Colors: ButtonColors, Sizes: any }; HelpMessage: _React.ComponentType; @@ -421,6 +426,7 @@ interface VendettaObject { Summary: _React.ComponentType; ErrorBoundary: _React.ComponentType; Codeblock: _React.ComponentType; + Search: _React.ComponentType; } toasts: { showToast: (content: string, asset: number) => void; diff --git a/src/ui/components/Search.tsx b/src/ui/components/Search.tsx new file mode 100644 index 0000000..c88f6e9 --- /dev/null +++ b/src/ui/components/Search.tsx @@ -0,0 +1,17 @@ +import { SearchProps } from "@types"; +import { stylesheet } from "@metro/common"; +import { findByName } from "@metro/filters"; + +const Search = findByName("StaticSearchBarContainer"); + +const styles = stylesheet.createThemedStyleSheet({ + search: { + margin: 0, + padding: 0, + borderBottomWidth: 0, + background: "none", + backgroundColor: "none", + } +}); + +export default ({ onChangeText, placeholder, style }: SearchProps) => \ No newline at end of file diff --git a/src/ui/components/index.ts b/src/ui/components/index.ts index c11a51e..0050bbf 100644 --- a/src/ui/components/index.ts +++ b/src/ui/components/index.ts @@ -4,7 +4,6 @@ import { findByName, findByProps } from "@metro/filters"; // Discord export const Forms = findByProps("Form", "FormSection"); export const General = findByProps("Button", "Text", "View"); -export const Search = findByName("StaticSearchBarContainer"); export const Alert = findByProps("alertDarkStyles", "alertLightStyles").default; export const Button = findByProps("Looks", "Colors", "Sizes") as React.ComponentType & { Looks: any, Colors: any, Sizes: any }; export const HelpMessage = findByName("HelpMessage"); @@ -14,4 +13,5 @@ export const SafeAreaView = findByProps("useSafeAreaInsets").SafeAreaView as typ // Vendetta export { default as Summary } from "@ui/components/Summary"; export { default as ErrorBoundary } from "@ui/components/ErrorBoundary"; -export { default as Codeblock } from "@ui/components/Codeblock"; \ No newline at end of file +export { default as Codeblock } from "@ui/components/Codeblock"; +export { default as Search } from "@ui/components/Search"; \ No newline at end of file diff --git a/src/ui/settings/pages/AssetBrowser.tsx b/src/ui/settings/pages/AssetBrowser.tsx index c621ccd..119ba60 100644 --- a/src/ui/settings/pages/AssetBrowser.tsx +++ b/src/ui/settings/pages/AssetBrowser.tsx @@ -1,4 +1,4 @@ -import { ReactNative as RN, stylesheet } from "@metro/common"; +import { ReactNative as RN } from "@metro/common"; import { all } from "@ui/assets"; import { Forms, Search } from "@ui/components"; import ErrorBoundary from "@ui/components/ErrorBoundary"; @@ -6,15 +6,6 @@ import AssetDisplay from "@ui/settings/components/AssetDisplay"; const { FormDivider } = Forms; -const styles = stylesheet.createThemedStyleSheet({ - search: { - margin: 0, - padding: 15, - borderBottomWidth: 0, - background: "none", - backgroundColor: "none", - } -}); export default function AssetBrowser() { const [search, setSearch] = React.useState(""); @@ -23,7 +14,6 @@ export default function AssetBrowser() { setSearch(v)} placeholder="Search" />