From e25060285807d7a8e16f99e71780562942fbed26 Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Thu, 23 Sep 2021 15:32:47 -0300 Subject: [PATCH] Changing SchoolPicker to SearchablePicker and switching to new component --- src/app/components/SchoolPicker.js | 131 ------------------------- src/app/components/SearchablePicker.js | 82 ++++++++++++++++ 2 files changed, 82 insertions(+), 131 deletions(-) delete mode 100644 src/app/components/SchoolPicker.js create mode 100644 src/app/components/SearchablePicker.js diff --git a/src/app/components/SchoolPicker.js b/src/app/components/SchoolPicker.js deleted file mode 100644 index 63b8aa9..0000000 --- a/src/app/components/SchoolPicker.js +++ /dev/null @@ -1,131 +0,0 @@ -import React, { useState, Fragment } from "react"; -import { StyleSheet, View } from "react-native"; - -import { FontAwesome5 } from "@expo/vector-icons"; -import colors from "../config/colors"; -import SearchableDropdown from "react-native-searchable-dropdown"; - -const items = [ - //substituir posteriormente pelas escolas - { - id: 1, - name: "JavaScript", - }, - { - id: 2, - name: "Java", - }, - { - id: 3, - name: "Ruby", - }, - { - id: 4, - name: "React Native", - }, - { - id: 5, - name: "PHP", - }, - { - id: 6, - name: "Python", - }, - { - id: 7, - name: "Python", - }, - { - id: 8, - name: "Python", - }, - - { - id: 9, - name: "Python", - }, -]; - -function SchoolPicker(props) { - const [selectedItems, setSelectedItems] = useState(null); - - const selected = (i) => { - setSelectedItems(i); - props.itemSelected(i); - //console.log(i.name); - }; - - return ( - - - - - - - - { - selected(item); - }} - itemStyle={{ - padding: 10, - marginTop: 2, - backgroundColor: "#fff", - borderColor: "#bbb", - borderWidth: 1, - borderRadius: 6, - width: "100%", - }} - itemTextStyle={{ color: "#222" }} - itemsContainerStyle={{ maxHeight: "100%" }} - items={items} - chip={true} - resetValue={false} - textInputProps={{ - placeholder: "Escola onde você estuda...", - underlineColorAndroid: "transparent", - style: { - padding: 12, - borderWidth: 1, - borderColor: "#ccc", - borderRadius: 5, - alignItems: "flex-start", - backgroundColor: colors.white, - alignContent: "flex-start", - }, - onTextChange: (text) => console.log(text), - }} - /> - - - - - ); -} - -SchoolPicker.defaultProps = { - itemSelected: () => {}, -}; - -const styles = StyleSheet.create({ - location: { - flexDirection: "row", - }, - adressText: { - flex: 1 - }, - mapIcon: { - paddingTop: 10, - alignSelf: "flex-start", - paddingRight: 12, - - }, -}); - -export default SchoolPicker; diff --git a/src/app/components/SearchablePicker.js b/src/app/components/SearchablePicker.js new file mode 100644 index 0000000..488f06a --- /dev/null +++ b/src/app/components/SearchablePicker.js @@ -0,0 +1,82 @@ +import React, { useState } from "react"; +import { StyleSheet, View } from "react-native"; + +import colors from "../config/colors"; +import DropDownPicker from "react-native-dropdown-picker"; +import { Shadow } from "react-native-shadow-2"; + + +function DropDown({ value, setValue, items, setItems, formPlaceholder, searchPlaceholder }) { + const [open, setOpen] = useState(false); + + return ( + + ); +} + +function SearchablePicker({ value, setValue, items, setItems, formPlaceholder, searchPlaceholder }) { + console.log(items ) + return ( + + + + + + ); +} + +const styles = StyleSheet.create({ + location: { + flex: 1, + alignSelf: "flex-start", + marginRight: 12, + marginLeft: 12, + }, +}); + +export default SearchablePicker;