analuizaff
4 years ago
9 changed files with 160 additions and 23 deletions
-
BINsrc/app/assets/rio_alto.png
-
BINsrc/app/assets/rio_baixo.png
-
BINsrc/app/assets/rio_normal.png
-
BINsrc/app/assets/rio_transbordando.png
-
2src/app/screens/PluviometerSharingDataScreen.js
-
16src/app/screens/RainSharingDataScreen.js
-
139src/app/screens/RiverFloodSharingDataScreen.js
-
10src/app/screens/SharingDataScreen.js
-
16src/app/screens/SharingFloodZonesScreen.js
After Width: 104 | Height: 106 | Size: 5.8 KiB |
After Width: 104 | Height: 105 | Size: 2.7 KiB |
After Width: 104 | Height: 105 | Size: 3.0 KiB |
After Width: 105 | Height: 104 | Size: 2.8 KiB |
@ -0,0 +1,139 @@ |
|||||
|
import React, { useState } from "react"; |
||||
|
import { Button, StyleSheet, View } from "react-native"; |
||||
|
import * as Yup from "yup"; |
||||
|
|
||||
|
import { |
||||
|
Form, |
||||
|
FormField, |
||||
|
FormPicker as Picker, |
||||
|
SubmitButton, |
||||
|
} from "../components/forms"; |
||||
|
import CategoryPickerItem from "../components/CategoryPickerItem"; |
||||
|
import Screen from "../components/Screen"; |
||||
|
import FormImagePicker from "../components/forms/FormImagePicker"; |
||||
|
import useLocation from "../hooks/useLocation"; |
||||
|
import { Image, Text, TouchableOpacity } from "react-native"; |
||||
|
import colors from "../config/colors"; |
||||
|
import { TouchableNativeFeedback } from "react-native-gesture-handler"; |
||||
|
|
||||
|
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"), |
||||
|
}); |
||||
|
|
||||
|
const borderWidth = 4; |
||||
|
|
||||
|
function RiverFloodSharingDataScreen() { |
||||
|
const [passable, setPassable] = useState(0); |
||||
|
|
||||
|
return ( |
||||
|
<Screen style={styles.container}> |
||||
|
<Text style={{ fontSize: 18, fontWeight: 'bold', color: '#1976D2', textAlign: 'center', marginBottom: 30 }}> |
||||
|
Nível da água do rio |
||||
|
</Text> |
||||
|
<Form |
||||
|
initialValues={{ |
||||
|
title: "", |
||||
|
price: "", |
||||
|
description: "", |
||||
|
category: null, |
||||
|
images: [], |
||||
|
}} |
||||
|
onSubmit={(values) => submitForm({ ...values, passable, location })} |
||||
|
validationSchema={validationSchema} |
||||
|
> |
||||
|
<View> |
||||
|
<View |
||||
|
style={{ flexDirection: "row", justifyContent: "space-around" }} |
||||
|
> |
||||
|
<TouchableNativeFeedback onPress={() => setPassable(0)}> |
||||
|
<View |
||||
|
borderWidth={passable == 0 ? borderWidth : 0} |
||||
|
style={styles.img_block} |
||||
|
> |
||||
|
<Image |
||||
|
style={styles.floodingLogo} |
||||
|
source={require("../assets/rio_baixo.png")} |
||||
|
/> |
||||
|
<Text style={styles.text}>Baixo</Text> |
||||
|
</View> |
||||
|
</TouchableNativeFeedback> |
||||
|
|
||||
|
<TouchableNativeFeedback onPress={() => setPassable(1)}> |
||||
|
<View |
||||
|
borderWidth={passable == 1 ? borderWidth : 0} |
||||
|
style={styles.img_block} |
||||
|
> |
||||
|
<Image |
||||
|
style={styles.floodingLogo} |
||||
|
source={require("../assets/rio_normal.png")} |
||||
|
/> |
||||
|
<Text style={styles.text}>Rio normal</Text> |
||||
|
</View> |
||||
|
</TouchableNativeFeedback> |
||||
|
</View> |
||||
|
|
||||
|
<View |
||||
|
style={{ flexDirection: "row", justifyContent: "space-around" }} |
||||
|
> |
||||
|
<TouchableNativeFeedback onPress={() => setPassable(2)}> |
||||
|
<View |
||||
|
borderWidth={passable == 2 ? borderWidth : 0} |
||||
|
style={styles.img_block} |
||||
|
> |
||||
|
<Image |
||||
|
style={styles.floodingLogo} |
||||
|
source={require("../assets/rio_alto.png")} |
||||
|
/> |
||||
|
<Text style={styles.text}>Alto</Text> |
||||
|
</View> |
||||
|
</TouchableNativeFeedback> |
||||
|
|
||||
|
<TouchableNativeFeedback onPress={() => setPassable(3)}> |
||||
|
<View |
||||
|
borderWidth={passable == 3 ? borderWidth : 0} |
||||
|
style={styles.img_block} |
||||
|
> |
||||
|
<Image |
||||
|
style={styles.floodingLogo} |
||||
|
source={require("../assets/rio_transbordando.png")} |
||||
|
/> |
||||
|
<Text style={styles.text}>Transbordando</Text> |
||||
|
</View> |
||||
|
</TouchableNativeFeedback> |
||||
|
</View> |
||||
|
</View> |
||||
|
<FormImagePicker backgroundColor="#1976D2" name="images" /> |
||||
|
|
||||
|
<SubmitButton title="Enviar" backgroundColor={colors.primary} /> |
||||
|
</Form> |
||||
|
</Screen> |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
const styles = StyleSheet.create({ |
||||
|
container: { |
||||
|
padding: 10, |
||||
|
}, |
||||
|
img_block: { |
||||
|
borderRadius: 5, |
||||
|
padding: 10, |
||||
|
borderStyle: "dotted", |
||||
|
borderColor: colors.primary, |
||||
|
alignItems: "center", |
||||
|
width:130, |
||||
|
}, |
||||
|
floodingLogo: { |
||||
|
width: 85, |
||||
|
height: 85, |
||||
|
}, |
||||
|
text: { |
||||
|
fontSize: 14, |
||||
|
textAlign: "center", |
||||
|
marginTop: 10, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
export default RiverFloodSharingDataScreen; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue