diff --git a/src/app/components/DatePicker.js b/src/app/components/DatePicker.js index 74c8b30..436d648 100644 --- a/src/app/components/DatePicker.js +++ b/src/app/components/DatePicker.js @@ -98,13 +98,13 @@ export default function DatePicker(props) { locale={"pt-br"} minimumDate={new Date(moment().subtract(1, "month"))} maximumDate={new Date(moment())} - // formatChosenDate={(selectedDate) => { - // if (mode == "date") { - // return moment(selectedDate).format("DD/mm/YYYY"); - // } else { - // return moment(selectedDate).format("HH:mm"); - // } - // }} //formatar a data e hora do selected date + formatChosenDate={(selectedDate) => { + if (mode == "date") { + return moment(selectedDate).format("DD/mm/YYYY"); + } else { + return moment(selectedDate).format("HH:mm"); + } + }} //formatar a data e hora do selected date display={Platform.OS === "ios" ? "spinner" : "default"} onChange={Platform.OS === "ios" ? onChange : androidOnChange} /> diff --git a/src/app/components/PickEventDateLocation.js b/src/app/components/PickEventDateLocation.js index 7b3015d..dfaac9f 100644 --- a/src/app/components/PickEventDateLocation.js +++ b/src/app/components/PickEventDateLocation.js @@ -23,7 +23,7 @@ export default function PickEventDateLocation({ paddingBottom:24 }} > - + {/* */} setTime(value)} time={time} /> - + {/* */} {location && ( navigation.navigate("FormMap")}> diff --git a/src/app/components/SchoolPicker.js b/src/app/components/SchoolPicker.js index 0bd3dbf..63b8aa9 100644 --- a/src/app/components/SchoolPicker.js +++ b/src/app/components/SchoolPicker.js @@ -1,140 +1,131 @@ -import React, { useState, Fragment } from "react"; +import React, { useState, Fragment } from "react"; import { StyleSheet, View } from "react-native"; -import { FontAwesome5 } from '@expo/vector-icons'; +import { FontAwesome5 } from "@expo/vector-icons"; import colors from "../config/colors"; -import SearchableDropdown from 'react-native-searchable-dropdown'; +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', - }, + //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) - }} - containerStyle={{ padding: 5 }} - itemStyle={{ - padding: 10, - marginTop: 2, - backgroundColor: '#ddd', - 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", - alignContent:"flex-start", - }, - onTextChange: text => console.log(text) - } + const [selectedItems, setSelectedItems] = useState(null); - } - listProps={ - { - nestedScrollEnabled: true, + 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: () =>{ }, + itemSelected: () => {}, }; const styles = StyleSheet.create({ - location: { - //flex: 1, - width: "100%", - flexDirection: "row", - alignItems: "flex-start", - justifyContent: "center", - zIndex: 10, - position: "absolute", - backgroundColor: colors.white, - }, - adressText: { - flex: 0.90, - }, - mapIcon: { - backgroundColor: colors.primary, - padding: 8, - width: 20, - alignItems: "center", - borderRadius: 5, - flex: 0.10, - marginTop: 8, - }, + location: { + flexDirection: "row", + }, + adressText: { + flex: 1 + }, + mapIcon: { + paddingTop: 10, + alignSelf: "flex-start", + paddingRight: 12, + + }, }); export default SchoolPicker; diff --git a/src/app/components/forms/FormDatePicker.js b/src/app/components/forms/FormDatePicker.js index 9333e0d..b75ea0c 100644 --- a/src/app/components/forms/FormDatePicker.js +++ b/src/app/components/forms/FormDatePicker.js @@ -1,71 +1,79 @@ -import React, { useState } from "react"; -import { - Modal, - StyleSheet, - Text, - TouchableHighlight, - View, - Platform, - TouchableOpacity, - Alert, -} from "react-native"; +import React from "react"; +import { StyleSheet, Text, View } from "react-native"; import { MaterialCommunityIcons } from "@expo/vector-icons"; import DateTimePicker from "@react-native-community/datetimepicker"; -import moment from "moment"; import colors from "../../config/colors"; import { dimensions } from "../../config/dimensions"; -import { showMessage } from "react-native-flash-message"; import DatePicker from "../../components/DatePicker"; -const FormDatePicker = (props) => { - console.log("date " + props.date + " time " + props.time) +function EventsDatePicker(props) { return ( - - - - - - - - {" "} - {props.date.format("DD/MM/YYYY")} {" | "}{" "} - {props.time.format("HH:mm")} + + + + + + {" "} + {props.date.format("DD/MM/YYYY")} {" | "} {props.time.format("HH:mm")} + + + + {props.subtitle ? props.subtitle : " Defina a data do evento"} - - - {props.subtitle ? props.subtitle : " Defina a data do evento"} - - - + + ); +} + +function PluvRegisterPicker(props) { + return ( + + + + + {props.date.format("DD/MM/YYYY")} {" | "} {props.time.format("HH:mm")} + + + + ); +} + +export default function FormDatePicker({ formTypeFace = "events", ...props }) { + return ( + + {formTypeFace == "events" + ? EventsDatePicker(props) + : PluvRegisterPicker(props)} + ); -}; +} const styles = StyleSheet.create({ dateInput: { - paddingLeft: 16, - height: "100%", + paddingLeft: 12, flexDirection: "column", justifyContent: "center", }, @@ -78,5 +86,3 @@ const styles = StyleSheet.create({ borderRadius: 5, }, }); - -export default FormDatePicker; diff --git a/src/app/components/forms/FormLocationPicker.js b/src/app/components/forms/FormLocationPicker.js index 4094ae3..5d460a8 100644 --- a/src/app/components/forms/FormLocationPicker.js +++ b/src/app/components/forms/FormLocationPicker.js @@ -12,12 +12,11 @@ function FormLocationPicker({ subtitle }) { return ( - @@ -33,15 +32,12 @@ function FormLocationPicker({ subtitle }) { {subtitle ? subtitle : "Defina o local no mapa"} - ); } const styles = StyleSheet.create({ location: { - flex: 1, - width: "100%", flexDirection: "row", alignContent: "space-around", justifyContent: "flex-start", @@ -49,13 +45,10 @@ const styles = StyleSheet.create({ adressText: { height: "100%", - paddingLeft: 24, + paddingLeft: 12, }, mapIcon: { - backgroundColor: colors.primary, - width: 40, - height: 40, justifyContent: "center", alignItems: "center", borderRadius: 5, diff --git a/src/app/components/forms/SubmitButton.js b/src/app/components/forms/SubmitButton.js index 068cdb8..6d968d9 100644 --- a/src/app/components/forms/SubmitButton.js +++ b/src/app/components/forms/SubmitButton.js @@ -4,12 +4,13 @@ import { useFormikContext } from "formik"; import Button from "../Button"; import {View} from "react-native"; -function SubmitButton({ title }) { +function SubmitButton({ title, paddingHorizontal = 16 }) { const { handleSubmit } = useFormikContext(); return ( + style={{paddingHorizontal: paddingHorizontal}} + >