|
@ -11,7 +11,8 @@ import colors from "../config/colors"; |
|
|
import { TouchableNativeFeedback } from "react-native-gesture-handler"; |
|
|
import { TouchableNativeFeedback } from "react-native-gesture-handler"; |
|
|
import { insertRiverData } from "../database/databaseLoader"; |
|
|
import { insertRiverData } from "../database/databaseLoader"; |
|
|
import { showMessage } from "react-native-flash-message"; |
|
|
import { showMessage } from "react-native-flash-message"; |
|
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; |
|
|
|
|
|
|
|
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; |
|
|
|
|
|
import assets from "../config/assets"; |
|
|
|
|
|
|
|
|
const validationSchema = Yup.object().shape({ |
|
|
const validationSchema = Yup.object().shape({ |
|
|
images: Yup.array().min(1, "Por favor, selecione ao menos uma imagem"), |
|
|
images: Yup.array().min(1, "Por favor, selecione ao menos uma imagem"), |
|
@ -37,91 +38,96 @@ function RiverFloodSharingDataScreen(props) { |
|
|
Nível da água do rio |
|
|
Nível da água do rio |
|
|
</Text> |
|
|
</Text> |
|
|
<KeyboardAwareScrollView |
|
|
<KeyboardAwareScrollView |
|
|
resetScrollToCoords={{ x: 0, y: 0 }} |
|
|
|
|
|
contentContainerStyle={styles.container} |
|
|
|
|
|
scrollEnabled={true}> |
|
|
|
|
|
<Form |
|
|
|
|
|
initialValues={{ |
|
|
|
|
|
images: [], |
|
|
|
|
|
}} |
|
|
|
|
|
onSubmit={(values) => { |
|
|
|
|
|
insertRiverData({ ...values, riverScale, location }); |
|
|
|
|
|
showMessage({ |
|
|
|
|
|
message: "Informação enviada!", |
|
|
|
|
|
duration: 1950, |
|
|
|
|
|
icon: "success", |
|
|
|
|
|
type: "success", |
|
|
|
|
|
}); |
|
|
|
|
|
props.navigation.goBack(null); |
|
|
|
|
|
}} |
|
|
|
|
|
validationSchema={validationSchema} |
|
|
|
|
|
|
|
|
resetScrollToCoords={{ x: 0, y: 0 }} |
|
|
|
|
|
contentContainerStyle={styles.container} |
|
|
|
|
|
scrollEnabled={true} |
|
|
> |
|
|
> |
|
|
<View> |
|
|
|
|
|
<View |
|
|
|
|
|
style={{ flexDirection: "row", justifyContent: "space-around" }} |
|
|
|
|
|
> |
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(0)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 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> |
|
|
|
|
|
|
|
|
<Form |
|
|
|
|
|
initialValues={{ |
|
|
|
|
|
images: [], |
|
|
|
|
|
}} |
|
|
|
|
|
onSubmit={(values) => { |
|
|
|
|
|
insertRiverData({ ...values, riverScale, location }); |
|
|
|
|
|
showMessage({ |
|
|
|
|
|
message: "Informação enviada!", |
|
|
|
|
|
duration: 1950, |
|
|
|
|
|
icon: "success", |
|
|
|
|
|
type: "success", |
|
|
|
|
|
}); |
|
|
|
|
|
props.navigation.goBack(null); |
|
|
|
|
|
}} |
|
|
|
|
|
validationSchema={validationSchema} |
|
|
|
|
|
> |
|
|
|
|
|
<View> |
|
|
|
|
|
<View |
|
|
|
|
|
style={{ flexDirection: "row", justifyContent: "space-around" }} |
|
|
|
|
|
> |
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(0)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 0 ? borderWidth : 0} |
|
|
|
|
|
style={styles.img_block} |
|
|
|
|
|
> |
|
|
|
|
|
<Image |
|
|
|
|
|
style={styles.floodingLogo} |
|
|
|
|
|
source={assets.riverLevel.low} |
|
|
|
|
|
/> |
|
|
|
|
|
<Text style={styles.text}>Baixo</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableNativeFeedback> |
|
|
|
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(1)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 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> |
|
|
|
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(1)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 1 ? borderWidth : 0} |
|
|
|
|
|
style={styles.img_block} |
|
|
|
|
|
> |
|
|
|
|
|
<Image |
|
|
|
|
|
style={styles.floodingLogo} |
|
|
|
|
|
source={assets.riverLevel.normal} |
|
|
|
|
|
/> |
|
|
|
|
|
<Text style={styles.text}>Rio normal</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableNativeFeedback> |
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
<View |
|
|
|
|
|
style={{ marginTop: 10, flexDirection: "row", justifyContent: "space-around" }} |
|
|
|
|
|
> |
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(2)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 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> |
|
|
|
|
|
|
|
|
<View |
|
|
|
|
|
style={{ |
|
|
|
|
|
marginTop: 10, |
|
|
|
|
|
flexDirection: "row", |
|
|
|
|
|
justifyContent: "space-around", |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(2)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 2 ? borderWidth : 0} |
|
|
|
|
|
style={styles.img_block} |
|
|
|
|
|
> |
|
|
|
|
|
<Image |
|
|
|
|
|
style={styles.floodingLogo} |
|
|
|
|
|
source={assets.riverLevel.high} |
|
|
|
|
|
/> |
|
|
|
|
|
<Text style={styles.text}>Alto</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableNativeFeedback> |
|
|
|
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(3)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 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> |
|
|
|
|
|
|
|
|
<TouchableNativeFeedback onPress={() => setRiverScale(3)}> |
|
|
|
|
|
<View |
|
|
|
|
|
borderWidth={riverScale == 3 ? borderWidth : 0} |
|
|
|
|
|
style={styles.img_block} |
|
|
|
|
|
> |
|
|
|
|
|
<Image |
|
|
|
|
|
style={styles.floodingLogo} |
|
|
|
|
|
source={assets.riverLevel.flooding} |
|
|
|
|
|
/> |
|
|
|
|
|
<Text style={styles.text}>Transbordando</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableNativeFeedback> |
|
|
|
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
|
|
|
|
|
|
<FormImagePicker backgroundColor="#1976D2" name="images" /> |
|
|
|
|
|
|
|
|
<FormImagePicker backgroundColor="#1976D2" name="images" /> |
|
|
|
|
|
|
|
|
<SubmitButton title="Enviar" backgroundColor={colors.primary} /> |
|
|
|
|
|
</Form> |
|
|
|
|
|
|
|
|
<SubmitButton title="Enviar" backgroundColor={colors.primary} /> |
|
|
|
|
|
</Form> |
|
|
</KeyboardAwareScrollView> |
|
|
</KeyboardAwareScrollView> |
|
|
</Screen> |
|
|
</Screen> |
|
|
); |
|
|
); |
|
|