Browse Source

Merge branch 'main' of github.com:IGSD-UoW/WPD-MobileApp

master
GabrielTrettel 4 years ago
parent
commit
f9fe24c481
  1. 6
      src/app/components/Button.js
  2. 1
      src/app/components/forms/FormImagePicker.js
  3. 1
      src/app/config/colors.js
  4. 5
      src/app/database/databaseLoader.js
  5. 3
      src/app/database/db.js
  6. 16
      src/app/screens/PluviometerSharingDataScreen.js

6
src/app/components/Button.js

@ -3,7 +3,7 @@ import { StyleSheet, Text, TouchableOpacity } from "react-native";
import colors from "../config/colors";
function AppButton({ title, onPress, color = "primary" }) {
function AppButton({ title, onPress, color = "lightBlue" }) {
return (
<TouchableOpacity
style={[styles.button, { backgroundColor: colors[color] }]}
@ -16,8 +16,8 @@ function AppButton({ title, onPress, color = "primary" }) {
const styles = StyleSheet.create({
button: {
backgroundColor: colors.primary,
borderRadius: 6,
backgroundColor: colors.lightBlue,
borderRadius: 20,
justifyContent: "center",
alignItems: "center",
width: "100%",

1
src/app/components/forms/FormImagePicker.js

@ -24,7 +24,6 @@ function FormImagePicker({ name }) {
return (
<View>
<Text style={styles.labelStyle}>Imagens: </Text>
<ImageInputList
imageUris={imageUris}
onAddImage={handleAdd}

1
src/app/config/colors.js

@ -10,4 +10,5 @@ export default {
lightGray: "#C4C4C4",
gray: "gray",
lightestGray: "#F0F0F0",
lightBlue:"#1976D2"
};

5
src/app/database/databaseLoader.js

@ -39,8 +39,8 @@ function insertFloodZone({ images, description, passable, location, date, time,
transaction(global.userDataBase, query, values);
}
function insertPluviometerData({ pluviometer, images, dateTime, time, location, address }) {
const query = `INSERT INTO Pluviometer(Date, Images, Latitude, Longitude, Precipitation, Address) VALUES(?, ?, ?, ?, ?, ?);`;
function insertPluviometerData({ pluviometer, description, images, dateTime, time, location, address }) {
const query = `INSERT INTO Pluviometer(Date, Images, Latitude, Longitude, Precipitation, Address, Description) VALUES(?, ?, ?, ?, ?, ?, ?);`;
if (location === undefined) {
console.debug("undefined location");
@ -54,6 +54,7 @@ function insertPluviometerData({ pluviometer, images, dateTime, time, location,
parseFloat(location["longitude"]),
parseFloat(pluviometer),
address,
description,
];
transaction(global.userDataBase, query, values);

3
src/app/database/db.js

@ -20,7 +20,8 @@ const init_queries = [
Longitude real NOT NULL,
Precipitation real NOT NULL,
Time text,
Address text
Address text,
Description text
);`,
`CREATE TABLE IF NOT EXISTS RainLevel (
Id integer PRIMARY KEY autoincrement,

16
src/app/screens/PluviometerSharingDataScreen.js

@ -30,11 +30,14 @@ const validationSchema = Yup.object().shape({
.label("pluviometer"),
//data: Yup.string().required("Campo obrigatório. Por favor, selecione a data"),
images: Yup.array(),
description: Yup.string().label("Description"),
});
function PluviometerSharingDataScreen(props) {
const context = useContext(EventLocationContext);
const amount = 2;
useEffect(() => {
context.defaultLocation();
}, []);
@ -51,6 +54,7 @@ function PluviometerSharingDataScreen(props) {
initialValues={{
pluviometer: "",
images: [],
description: "",
}}
onSubmit={(values) => {
insertPluviometerData({ ...values, dateTime, time, location, address });
@ -115,7 +119,15 @@ function PluviometerSharingDataScreen(props) {
</TouchableOpacity>
</View>
</View>
<View>
<FormField
maxLength={255}
multiline
name="description"
numberOfLines={3}
placeholder="Descrição"
/>
</View>
<SubmitButton title="Enviar" style={{ marginBottom: 100 }} />
<View style={{ flex: 1 }}></View>
</Form>
@ -139,7 +151,7 @@ const styles = StyleSheet.create({
fontSize: dimensions.text.secondary,
fontWeight: "bold",
textAlign: "left",
color: colors.primary,
color: colors.lightBlue,
marginBottom: 5,
},
});

Loading…
Cancel
Save