diff --git a/src/app/components/forms/FormField.js b/src/app/components/forms/FormField.js
index a0888b1..9ed1558 100644
--- a/src/app/components/forms/FormField.js
+++ b/src/app/components/forms/FormField.js
@@ -33,6 +33,75 @@ function IncreaseDecreaseButtons({ content }) {
);
}
+function RenderPluviometerInput({
+ name,
+ setFieldTouched,
+ setFieldValue,
+ otherProps,
+ width,
+ values,
+}) {
+ console.log(name == "pluviometer");
+ const [fieldVal, setFieldVal] = useState(values[name]);
+
+ useEffect(() => {
+ setFieldValue(name, fieldVal, true);
+ }, [fieldVal]);
+
+ const increase = () => {
+ setFieldVal((Number(fieldVal) + 1).toString());
+ };
+
+ const decrease = () => {
+ setFieldVal((Number(fieldVal) - 1).toString());
+ };
+
+ return (
+
+
+ setFieldTouched(name)}
+ onChangeText={(val) => {
+ setFieldVal(val);
+ }}
+ width={width}
+ value={fieldVal.toString()}
+ {...otherProps}/>
+
+
+ {
+ increase();
+ }}
+ style={{
+ paddingLeft: 4,
+ paddingBottom: 8,
+ paddingRight: 1.5,
+ }}
+ >
+
+
+
+ {
+ decrease();
+ }}
+ style={{
+ paddingLeft: 1.5,
+ paddingBottom: 8,
+ paddingRight: 16,
+ }}
+ >
+
+
+
+ );
+}
+
function AppFormField({
name,
width,
@@ -43,88 +112,41 @@ function AppFormField({
values,
setFieldTouched,
setFieldValue,
+ handleChange,
errors,
touched,
} = useFormikContext();
- const [pluv, setPluv] = useState(0);
-
- console.log(values);
- console.log(pluv);
-
- useEffect(() => {
- setFieldValue("pluviometer", Number(pluv), true);
- }, [pluv]);
-
- const increase = () => {
- setPluv((Number(pluv) + 1).toString());
- };
-
- const decrease = () => {
- setPluv((Number(pluv) - 1).toString());
- };
-
return (
-
- setFieldTouched(name)}
- onChangeText={(val) => {
- setPluv(val);
- }}
- width={width}
- value={pluv}
- {...otherProps}
- />
-
-
- {increaseDecreaseButtons && (
- <>
- {
- increase();
- }}
- style={{
- paddingLeft: 4,
- paddingBottom: 8,
- paddingRight: 1.5,
- }}
- >
-
-
-
- {
- decrease();
- }}
- style={{
- paddingLeft: 1.5,
- paddingBottom: 8,
- paddingRight: 16,
- }}
- >
-
-
- >
- )}
+ {name != "pluviometer" ? (
+ setFieldTouched(name)}
+ onChangeText={handleChange(name)}
+ width={width}
+ {...otherProps}
+ />
+ ) : (
+
+ )}
-
-
-
+
+
+
);
}
diff --git a/src/app/screens/LoginScreen.js b/src/app/screens/LoginScreen.js
index 90fd8eb..12f1005 100644
--- a/src/app/screens/LoginScreen.js
+++ b/src/app/screens/LoginScreen.js
@@ -1,5 +1,5 @@
import React, { useState, useContext } from "react";
-import { StyleSheet, View, Text } from "react-native";
+import { StyleSheet, View } from "react-native";
import * as Yup from "yup";
import {
Form,
@@ -10,7 +10,6 @@ import {
import Screen from "../components/Screen";
import colors from "../config/colors";
import { dimensions } from "../config/dimensions";
-import { TouchableNativeFeedback } from "react-native-gesture-handler";
import login from "../api/auth";
import jwdDecode from "jwt-decode";
import { AuthContext } from "../auth/context";
@@ -59,33 +58,42 @@ export default function LoginScreen(props) {
handleSubmit(name, password, setLoginFailed)
}
>
-
+
+
-
-
+
-
+
+
+
-
+
+
+
+
+
{/* {
props.navigation.navigate("Register");
@@ -103,7 +111,6 @@ export default function LoginScreen(props) {
const styles = StyleSheet.create({
containter: {
- padding: 10,
justifyContent: "center",
},
});