import React, { useState } from "react"; import { StyleSheet, Text, Image, View } from "react-native"; import * as Yup from "yup"; import { Form, SubmitButton, FormField } from "../components/forms"; import FormImagePicker from "../components/forms/FormImagePicker"; import useLocation from "../hooks/useLocation"; import colors from "../config/colors"; import { scaleDimsFromWidth } from "../config/dimensions"; import { TouchableNativeFeedback } from "react-native-gesture-handler"; import { insertFloodZone } from "../database/databaseLoader"; import { showMessage } from "react-native-flash-message"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; import Screen from "../components/Screen"; function submitForm(props) { // console.log(props); insertFloodZone(props); } const validationSchema = Yup.object().shape({ images: Yup.array().min(1, "Por favor, selecione ao menos uma imagem"), description: Yup.string() .label("Description") .required("Por favor, forneça uma descrição"), }); function SharingFloodZonesScreen(props) { const [passable, setPassable] = useState(0); const location = useLocation(); return ( Pontos de alagamento
{ submitForm({ ...values, passable, location }); showMessage({ message: "Informação enviada!", duration: 1950, icon: "success", type: "success", }); props.navigation.goBack(null); }} validationSchema={validationSchema} > setPassable(1)}> Transitável setPassable(0)}> Intransitável
); } const borderWidth = 3; const styles = StyleSheet.create({ container: { padding: 10, }, header: { fontSize: 18, color: colors.primary, fontWeight: "500", }, image: { ...scaleDimsFromWidth(150, 80, 35.0), resizeMode: "contain", }, img_block: { padding: 10, borderRadius: 5, borderStyle: "dotted", borderColor: colors.primary, justifyContent: "center", alignItems: "center", }, imgs_container: { alignSelf: "center", flexGrow: 1, flexDirection: "row", justifyContent: "space-between", }, text: { fontSize: 14, }, }); export default SharingFloodZonesScreen;