diff --git a/locales/de.json b/locales/de.json
index ef0ab17..8e91fbe 100644
--- a/locales/de.json
+++ b/locales/de.json
@@ -1,5 +1,8 @@
{
- "test": "Einstellungen",
+ "common": {
+ "textInputPlaceholderSearch": "Suche",
+ "pickerSearchFilterNoResults": "Keine Ergebnisse gefunden"
+ },
"sideBar": {
"devicesTitle": "Geräte",
"settings": "Einstellungen",
diff --git a/locales/en.json b/locales/en.json
index 37df20d..830347f 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -1,5 +1,8 @@
{
- "test": "Settings",
+ "common": {
+ "textInputPlaceholderSearch": "Search",
+ "pickerSearchFilterNoResults": "No results found"
+ },
"sideBar": {
"devicesTitle": "Devices",
"settings": "Settings",
diff --git a/src/Components/Icon/index.js b/src/Components/Icon/index.js
index ea2cf11..d9713c6 100644
--- a/src/Components/Icon/index.js
+++ b/src/Components/Icon/index.js
@@ -1,5 +1,5 @@
import Icon from "@expo/vector-icons/MaterialCommunityIcons";
-export default function MyIcon({ name, color, size }) {
- return ;
+export default function MyIcon({ style, name, color, size }) {
+ return ;
}
diff --git a/src/Components/PickerModal/index.js b/src/Components/PickerModal/index.js
index 3c3cac0..3da07d7 100644
--- a/src/Components/PickerModal/index.js
+++ b/src/Components/PickerModal/index.js
@@ -1,12 +1,26 @@
-import { useContext } from "react";
+import { useContext, useState } from "react";
import { AppContext, AppStyles } from "../../utils";
-import Icon from "@expo/vector-icons/MaterialCommunityIcons";
-import { Modal, Text, TouchableOpacity, View } from "react-native";
+import { Modal, Text, TextInput, TouchableOpacity, View } from "react-native";
import { Divider } from "../Divider";
+import MyIcon from "../Icon";
+import { useTranslation } from "react-i18next";
-export default function PickerModal({ isOpen, setIsOpen, items }) {
+export default function PickerModal({
+ isOpen,
+ setIsOpen,
+ items,
+ searchFilter,
+}) {
const appContext = useContext(AppContext);
- const closeModal = () => setIsOpen(false);
+ const { t } = useTranslation();
+ const [providedItems, setProvidedItems] = useState(items);
+ const [searchFilterInput, setSearchFilterInput] = useState("");
+
+ const closeModal = () => {
+ setIsOpen(false);
+ setProvidedItems(items);
+ setSearchFilterInput("");
+ };
return (
- {
- console.log("press");
- setIsOpen(false);
- }}
- >
-
-
+
+ closeModal()}>
+
+
- {items.map((item, i) => {
+ {searchFilter && (
+
+
+ {
+ setSearchFilterInput(text);
+
+ setProvidedItems((provItems) => {
+ let newProvItems = [...provItems];
+
+ newProvItems = items.filter((provItem) => {
+ return provItem.label.startsWith(text);
+ });
+
+ return newProvItems;
+ });
+ }}
+ />
+ {searchFilterInput !== "" && (
+ {
+ setSearchFilterInput("");
+ setProvidedItems(items);
+ }}
+ >
+
+
+ )}
+
+ )}
+
+
+ {providedItems.length === 0 && (
+
+
+
+ {t("common.pickerSearchFilterNoResults")}
+
+
+ )}
+
+ {providedItems.map((item, i) => {
return item.selected ? (
closeModal()}>
@@ -54,7 +144,7 @@ export default function PickerModal({ isOpen, setIsOpen, items }) {
>
{item.label}
-
{
diff --git a/src/utils.js b/src/utils.js
index de087f9..d03bf8f 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -55,6 +55,7 @@ const DarkAppTheme = {
},
},
divider: "#434443",
+ textInputBottomColor: "#b2b3b3",
icon: "#ddd",
switch: {
trackColorTrue: "#01d064",
@@ -91,6 +92,7 @@ const LightAppTheme = {
},
},
divider: "#ddd",
+ textInputBottomColor: "#b2b3b3",
icon: "#000",
switch: {
trackColorTrue: "#01d064",