|
|
@ -15,18 +15,18 @@ import Screen from "../components/Screen"; |
|
|
|
import assets from "../config/assets"; |
|
|
|
|
|
|
|
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"), |
|
|
|
images: Yup.array(), |
|
|
|
description: Yup.string().label("Description"), |
|
|
|
}); |
|
|
|
|
|
|
|
function SharingFloodZonesScreen(props) { |
|
|
|
const [passable, setPassable] = useState(0); |
|
|
|
const [passable, setPassable] = useState(-1); |
|
|
|
const [error, setError] = useState(false); |
|
|
|
const location = useLocation(); |
|
|
|
|
|
|
|
return ( |
|
|
@ -53,6 +53,10 @@ function SharingFloodZonesScreen(props) { |
|
|
|
description: "", |
|
|
|
}} |
|
|
|
onSubmit={(values) => { |
|
|
|
if (passable == -1) { |
|
|
|
setError(true); |
|
|
|
return; |
|
|
|
} |
|
|
|
submitForm({ ...values, passable, location }); |
|
|
|
showMessage({ |
|
|
|
message: "Informação enviada!", |
|
|
@ -92,6 +96,10 @@ function SharingFloodZonesScreen(props) { |
|
|
|
</TouchableNativeFeedback> |
|
|
|
</View> |
|
|
|
|
|
|
|
{error && passable == -1 && ( |
|
|
|
<Text style={styles.error_txt}>Selecione ao menos uma opção</Text> |
|
|
|
)} |
|
|
|
|
|
|
|
<FormImagePicker name="images" height={10} /> |
|
|
|
<FormField |
|
|
|
maxLength={255} |
|
|
@ -106,7 +114,7 @@ function SharingFloodZonesScreen(props) { |
|
|
|
</Screen> |
|
|
|
); |
|
|
|
} |
|
|
|
const borderWidth = 3; |
|
|
|
const borderWidth = 4; |
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
|
container: { |
|
|
@ -142,6 +150,10 @@ const styles = StyleSheet.create({ |
|
|
|
text: { |
|
|
|
fontSize: 14, |
|
|
|
}, |
|
|
|
error_txt: { |
|
|
|
fontSize: 18, |
|
|
|
color: colors.danger, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
export default SharingFloodZonesScreen; |