import React, { useState } from "react"; import { StyleSheet, View } from "react-native"; import * as Yup from "yup"; import { Form, FormPicker as Picker, SubmitButton } from "../components/forms"; import Screen from "../components/Screen"; import FormImagePicker from "../components/forms/FormImagePicker"; import useLocation from "../hooks/useLocation"; import { Image, Text } from "react-native"; import colors from "../config/colors"; import { TouchableNativeFeedback } from "react-native-gesture-handler"; import { insertRiverData } from "../database/databaseLoader"; import { showMessage } from "react-native-flash-message"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; import assets from "../config/assets"; import { scaleDimsFromWidth } from "../config/dimensions"; const validationSchema = Yup.object().shape({ images: Yup.array(), }); const borderWidth = 4; function RiverFloodSharingDataScreen(props) { const [riverScale, setRiverScale] = useState(-1); const location = useLocation(); const [error, setError] = useState(false); return ( Nível da água do rio
{ if (riverScale == -1) { setError(true); return; } insertRiverData({ ...values, riverScale, location }); showMessage({ message: "Informação enviada!", duration: 1950, icon: "success", type: "success", }); props.navigation.goBack(null); }} validationSchema={validationSchema} > setRiverScale(0)}> Baixo setRiverScale(1)}> Rio normal setRiverScale(2)}> Alto setRiverScale(3)}> Transbordando {error && riverScale == -1 && ( Selecione ao menos uma opção )}
); } const dims = scaleDimsFromWidth(85, 85, 42); const styles = StyleSheet.create({ container: { padding: 10, backgroundColor: colors.white, }, img_block: { borderRadius: 5, padding: 10, borderStyle: "dotted", borderColor: colors.white, borderWidth: borderWidth, alignItems: "center", width: dims.width, }, floodingLogo: { width: dims.width * 0.8, height: dims.height * 0.8, }, imgs_row: { flexDirection: "row", justifyContent: "space-between", }, text: { fontSize: 14, textAlign: "center", marginTop: 10, }, error_txt: { fontSize: 18, color: colors.danger, }, }); export default RiverFloodSharingDataScreen;