Browse Source

Changing keyboard type to decimal for IOS compatibility and minor

refactoring.
master
GabrielTrettel 4 years ago
parent
commit
ead3412f65
  1. 1
      src/app/config/colors.js
  2. 31
      src/app/screens/PluviometerSharingDataScreen.js

1
src/app/config/colors.js

@ -8,4 +8,5 @@ export default {
dark: "#0c0c0c", dark: "#0c0c0c",
danger: "#ff5252", danger: "#ff5252",
lightGray: "#d3d3d3", lightGray: "#d3d3d3",
gray: "gray",
}; };

31
src/app/screens/PluviometerSharingDataScreen.js

@ -1,14 +1,6 @@
import React, { useState } from "react"; import React, { useState } from "react";
import {
StyleSheet,
Text,
View,
Image,
ScrollView,
} from "react-native";
import { StyleSheet, Text, View, Image, ScrollView } from "react-native";
import * as Yup from "yup"; import * as Yup from "yup";
import { import {
Form, Form,
FormField, FormField,
@ -22,6 +14,7 @@ import { insertPluviometerData } from "../database/databaseLoader";
import { showMessage } from "react-native-flash-message"; import { showMessage } from "react-native-flash-message";
import { scaleDimsFromWidth } from "../config/dimensions"; import { scaleDimsFromWidth } from "../config/dimensions";
import FormDatePicker from "../components/forms/FormDatePicker"; import FormDatePicker from "../components/forms/FormDatePicker";
import colors from "../config/colors/";
const dims = scaleDimsFromWidth(85, 85, 25); const dims = scaleDimsFromWidth(85, 85, 25);
@ -35,7 +28,6 @@ const validationSchema = Yup.object().shape({
images: Yup.array(), images: Yup.array(),
}); });
function PluviometerSharingDataScreen(props) { function PluviometerSharingDataScreen(props) {
const location = useLocation(); const location = useLocation();
@ -48,7 +40,9 @@ function PluviometerSharingDataScreen(props) {
style={styles.image} style={styles.image}
source={require("../assets/pluviometro.png")} source={require("../assets/pluviometro.png")}
/> />
<Text style={{ fontSize: 18, fontWeight: "bold", color: "#1976D2" }}>
<Text
style={{ fontSize: 18, fontWeight: "bold", color: colors.primary }}
>
Pluviômetro Pluviômetro
</Text> </Text>
</View> </View>
@ -56,7 +50,6 @@ function PluviometerSharingDataScreen(props) {
<Form <Form
initialValues={{ initialValues={{
pluviometer: "", pluviometer: "",
//data: "",
images: [], images: [],
}} }}
onSubmit={(values) => { onSubmit={(values) => {
@ -74,7 +67,7 @@ function PluviometerSharingDataScreen(props) {
<View style={{ marginTop: 30, flex: 1 }}> <View style={{ marginTop: 30, flex: 1 }}>
<Text style={styles.labelStyle}>Quantidade de chuva:</Text> <Text style={styles.labelStyle}>Quantidade de chuva:</Text>
<FormField <FormField
keyboardType="number-pad"
keyboardType="decimal-pad"
maxLength={200} maxLength={200}
name="pluviometer" name="pluviometer"
placeholder="Digite a quantidade de chuva" placeholder="Digite a quantidade de chuva"
@ -82,20 +75,20 @@ function PluviometerSharingDataScreen(props) {
</View> </View>
<View style={{ marginTop: 10, flex: 1 }}> <View style={{ marginTop: 10, flex: 1 }}>
<Text style={styles.labelStyle}>Data da coleta:</Text>
<Text style={styles.labelStyle}>Data da coleta:</Text>
<FormDatePicker <FormDatePicker
textStyle={{ textStyle={{
padding: 15, padding: 15,
borderColor: "gray",
borderColor: colors.gray,
borderWidth: 3, borderWidth: 3,
}} }}
defaultDate={new Date()} defaultDate={new Date()}
onDateChange={(value) => setDateTime(value)} onDateChange={(value) => setDateTime(value)}
/> />
</View> </View>
<FormImagePicker <FormImagePicker
backgroundColor="#1976D2"
backgroundColor={colors.primary}
name="images" name="images"
styles={{ width: 50 }} styles={{ width: 50 }}
/> />
@ -107,8 +100,6 @@ function PluviometerSharingDataScreen(props) {
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
padding: 10, padding: 10,
@ -124,7 +115,7 @@ const styles = StyleSheet.create({
fontSize: 16, fontSize: 16,
fontWeight: "bold", fontWeight: "bold",
textAlign: "left", textAlign: "left",
color: "#1976D2",
color: colors.primary,
marginBottom: 5, marginBottom: 5,
}, },
}); });

Loading…
Cancel
Save