From 4b41b8ad3beb05044536150494a42f5487db0070 Mon Sep 17 00:00:00 2001 From: analuizaff Date: Thu, 25 Mar 2021 16:07:46 -0300 Subject: [PATCH] school picker for pluviometer register screen --- src/app/components/SchoolPicker.js | 127 +++++++++++++++++++++++++++++ src/package-lock.json | 5 ++ src/package.json | 1 + 3 files changed, 133 insertions(+) create mode 100644 src/app/components/SchoolPicker.js diff --git a/src/app/components/SchoolPicker.js b/src/app/components/SchoolPicker.js new file mode 100644 index 0000000..e4e6673 --- /dev/null +++ b/src/app/components/SchoolPicker.js @@ -0,0 +1,127 @@ +import React, { useContext, useState, Component, Fragment } from "react"; +import { StyleSheet, Text, View, PixelRatio, Picker } from "react-native"; + +import { MaterialIcons } from "@expo/vector-icons"; +import { FontAwesome5 } from '@expo/vector-icons'; +import colors from "../config/colors"; +import { dimensions } from "../config/dimensions"; +import Screen from "./Screen"; +import SearchableDropdown from 'react-native-searchable-dropdown'; + +const items = [ + { + 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', + }, +]; + +function SchoolPicker() { + const [selectedItems, setSelectedItems] = useState(null); + console.log(selectedItems); + + + return ( + + + + + + + + { + setSelectedItems(item) + }} + containerStyle={{ padding: 5 }} + itemStyle={{ + padding: 10, + marginTop: 2, + backgroundColor: '#ddd', + borderColor: '#bbb', + borderWidth: 1, + borderRadius: 5, + }} itemTextStyle={{ color: '#222' }} + itemsContainerStyle={{ maxHeight: 140 }} + items={items} + chip={true} + resetValue={false} + textInputProps={ + { + placeholder: "Escola onde vocĂȘ estuda...", + underlineColorAndroid: "transparent", + style: { + padding: 12, + borderWidth: 1, + borderColor: '#ccc', + borderRadius: 5, + }, + onTextChange: text => console.log(text) + } + } + listProps={ + { + nestedScrollEnabled: false, + + } + } + /> + + + + + + ); +} + +const styles = StyleSheet.create({ + location: { + flex: 1, + width: "100%", + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + // backgroundColor: colors.secondary, + }, + adressText: { + flex: 1, + textAlign: "center", + }, + mapIcon: { + backgroundColor: colors.primary, + padding: 8, + width: 20, + alignItems: "center", + borderRadius: 5, + flex: 0.10, + }, +}); + +export default SchoolPicker; diff --git a/src/package-lock.json b/src/package-lock.json index 7649869..f69f45e 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -14844,6 +14844,11 @@ "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-2.10.1.tgz", "integrity": "sha512-Z2kKSk4AwWRQNCBmTjViuBQK0/Lx0jc25TZptn/2gKYUCOuVRvCekoA26u0Tsb3BIQ8tWDsZW14OwDlFUXW1aw==" }, + "react-native-searchable-dropdown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/react-native-searchable-dropdown/-/react-native-searchable-dropdown-1.1.3.tgz", + "integrity": "sha512-ip6YwjKED/h27oRQGN3f62usFMj5IfS6tr/zZWfQItCAV/XAq5E9P0Exvg/86gSlcGJnnZdoixK+PS1sElxcyA==" + }, "react-native-simple-dialogs": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/react-native-simple-dialogs/-/react-native-simple-dialogs-1.4.0.tgz", diff --git a/src/package.json b/src/package.json index fda1664..814c181 100644 --- a/src/package.json +++ b/src/package.json @@ -45,6 +45,7 @@ "react-native-reanimated": "~1.13.0", "react-native-safe-area-context": "3.1.4", "react-native-screens": "~2.10.1", + "react-native-searchable-dropdown": "^1.1.3", "react-native-simple-dialogs": "^1.4.0", "react-native-svg": "^12.1.0", "react-native-svg-uri": "^1.2.3",