[UI > AssetBrowser] Add

This commit is contained in:
Beef 2022-10-23 00:38:04 +01:00
parent ed5fc58845
commit 111720806c
4 changed files with 63 additions and 1 deletions

View file

@ -0,0 +1,27 @@
import { React, ReactNative as RN } from "@metro/common";
import { Forms } from "@ui/components";
import { all } from "@ui/assets";
import AssetDisplay from "./AssetDisplay";
const { FormInput } = Forms
export default function AssetBrowser() {
const [searchName, setSearchName] = React.useState("");
return (
<>
<FormInput
value={searchName}
onChange={(v: string) => setSearchName(v)}
title="SEARCH"
/>
<RN.FlatList
data={Object.values(all).filter(a => a.name.startsWith(searchName))}
renderItem={({ item }) => (
<AssetDisplay asset={item} />
)}
keyExtractor={item => item.name}
/>
</>
)
}