Browse Source

Rain form with "Descrição" field.

master
GabrielTrettel 4 years ago
parent
commit
894c844e95
  1. 5
      src/app/hooks/selectFromDB.js
  2. 15
      src/app/screens/RainSharingDataScreen.js

5
src/app/hooks/selectFromDB.js

@ -120,15 +120,16 @@ function parseRainLevel(row) {
"Pancada de chuva", "Pancada de chuva",
]; ];
const rainIdx = row["RainIdx"]; const rainIdx = row["RainIdx"];
return { return {
ID: ++ID, ID: ++ID,
title: "Nível da chuva",
title: rainLevel[rainIdx],
coordinate: { coordinate: {
latitude: row["Latitude"], latitude: row["Latitude"],
longitude: row["Longitude"] + displacement, longitude: row["Longitude"] + displacement,
}, },
image: custom_assets.rainLevel[rainIdx], image: custom_assets.rainLevel[rainIdx],
description: rainLevel[rainIdx],
description: row["Description"],
}; };
} }

15
src/app/screens/RainSharingDataScreen.js

@ -2,7 +2,12 @@ import React, { useState } from "react";
import { StyleSheet, View, ScrollView } from "react-native"; import { StyleSheet, View, ScrollView } from "react-native";
import * as Yup from "yup"; import * as Yup from "yup";
import { Form, FormPicker as Picker, SubmitButton } from "../components/forms";
import {
Form,
FormPicker as Picker,
SubmitButton,
FormField,
} from "../components/forms";
import Screen from "../components/Screen"; import Screen from "../components/Screen";
import FormImagePicker from "../components/forms/FormImagePicker"; import FormImagePicker from "../components/forms/FormImagePicker";
import useLocation from "../hooks/useLocation"; import useLocation from "../hooks/useLocation";
@ -16,6 +21,7 @@ import assets from "../config/assets";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
images: Yup.array(), images: Yup.array(),
description: Yup.string().label("Description"),
}); });
const borderWidth = 4; const borderWidth = 4;
@ -150,6 +156,13 @@ function RainSharingDataScreen(props) {
<FormImagePicker backgroundColor={colors.primary} name="images" /> <FormImagePicker backgroundColor={colors.primary} name="images" />
<FormField
maxLength={255}
multiline
name="description"
numberOfLines={3}
placeholder="Descrição"
/>
<SubmitButton title="Enviar" backgroundColor={colors.primary} /> <SubmitButton title="Enviar" backgroundColor={colors.primary} />
</Form> </Form>
</ScrollView> </ScrollView>

Loading…
Cancel
Save