Browse Source

Adding more spacing to searcheble picker list items

master
GabrielTrettel 3 years ago
parent
commit
65aadbbab2
  1. 14
      src/app/components/SearchablePicker.js
  2. 1
      src/app/screens/RegisterScreen.js

14
src/app/components/SearchablePicker.js

@ -3,7 +3,6 @@ import { StyleSheet, View } from "react-native";
import colors from "../config/colors"; import colors from "../config/colors";
import DropDownPicker from "react-native-dropdown-picker"; import DropDownPicker from "react-native-dropdown-picker";
import { Shadow } from "react-native-shadow-2";
import { useFormikContext } from "formik"; import { useFormikContext } from "formik";
import { ErrorMessage } from "./forms"; import { ErrorMessage } from "./forms";
import defaultStyles from "../config/styles"; import defaultStyles from "../config/styles";
@ -16,6 +15,7 @@ function DropDown({
formPlaceholder, formPlaceholder,
searchPlaceholder, searchPlaceholder,
nothingToShow, nothingToShow,
doubleItemLine,
}) { }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -54,6 +54,16 @@ function DropDown({
modalProps={{ modalProps={{
animationType: "fade", animationType: "fade",
}} }}
selectedItemLabelStyle={{
fontWeight: "bold",
}}
listItemContainerStyle={
doubleItemLine && {
marginVertical: 5,
numberOfLines: 3,
height: 50,
}
}
/> />
); );
} }
@ -68,6 +78,7 @@ function SearchablePicker({
nothingToShow = "Não encontramos nada com esse termo", nothingToShow = "Não encontramos nada com esse termo",
marginRight = 2, marginRight = 2,
marginLeft = 16, marginLeft = 16,
doubleItemLine = false,
}) { }) {
const { values, setFieldValue, errors, touched } = name const { values, setFieldValue, errors, touched } = name
? useFormikContext() ? useFormikContext()
@ -95,6 +106,7 @@ function SearchablePicker({
formPlaceholder={formPlaceholder} formPlaceholder={formPlaceholder}
searchPlaceholder={searchPlaceholder} searchPlaceholder={searchPlaceholder}
nothingToShow={nothingToShow} nothingToShow={nothingToShow}
doubleItemLine={doubleItemLine}
/> />
{name && <ErrorMessage error={errors[name]} visible={touched[name]} />} {name && <ErrorMessage error={errors[name]} visible={touched[name]} />}

1
src/app/screens/RegisterScreen.js

@ -212,6 +212,7 @@ function InstitutionNamePicker({ name }) {
items={items} items={items}
setItems={setItems} setItems={setItems}
formPlaceholder={"Selecione o nome da instituição"} formPlaceholder={"Selecione o nome da instituição"}
doubleItemLine={true}
nothingToShow={ nothingToShow={
institutions?.state?.instType institutions?.state?.instType
? "Não encontramos nada com esse termo" ? "Não encontramos nada com esse termo"

Loading…
Cancel
Save