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