From 90d753d60ba800a08ef5a14c5bb4781317b5f4f5 Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Wed, 10 Nov 2021 17:21:32 -0300 Subject: [PATCH] Preparing FormField changing shadow props to secure-field --- src/app/components/TextInput.js | 38 +++++++--------- src/app/components/forms/FormField.js | 44 ++++++++----------- src/app/config/styles.js | 15 ++++++- src/app/screens/ActivateInstitutionCode.js | 6 +-- src/app/screens/LoginScreen.js | 2 - .../screens/PluviometerSharingDataScreen.js | 2 +- src/app/screens/RegisterScreen.js | 6 --- src/app/screens/SharingFloodZonesScreen.js | 2 +- 8 files changed, 53 insertions(+), 62 deletions(-) diff --git a/src/app/components/TextInput.js b/src/app/components/TextInput.js index 4fa888d..f7579ce 100644 --- a/src/app/components/TextInput.js +++ b/src/app/components/TextInput.js @@ -7,35 +7,27 @@ import { Shadow } from "react-native-shadow-2"; function AppTextInput({ icon, width = "100%", ...otherProps }) { return ( - - - {icon && ( - - )} - + {icon && ( + - - + )} + + ); } const styles = StyleSheet.create({ container: { + ...defaultStyles.shadow, backgroundColor: colors.white, borderRadius: 6, borderColor: colors.grayBG, diff --git a/src/app/components/forms/FormField.js b/src/app/components/forms/FormField.js index c869e6c..425e244 100644 --- a/src/app/components/forms/FormField.js +++ b/src/app/components/forms/FormField.js @@ -6,30 +6,23 @@ import ErrorMessage from "./ErrorMessage"; import { View, Text } from "react-native"; import { TouchableOpacity } from "react-native-gesture-handler"; import colors from "../../config/colors"; -import { Shadow } from "react-native-shadow-2"; +import defaultStyles from "../../config/styles"; function IncreaseDecreaseButtons({ content }) { return ( - - - {content} - - + {content} + ); } @@ -48,11 +41,12 @@ function RenderPluviometerInput({ }, [fieldVal]); const increase = () => { - (Number(fieldVal) + 1) <= 999 && setFieldVal((Number(fieldVal) + 1).toString()); + Number(fieldVal) + 1 <= 999 && + setFieldVal((Number(fieldVal) + 1).toString()); }; const decrease = () => { - (Number(fieldVal) - 1) >= 0 && setFieldVal((Number(fieldVal) - 1).toString()); + Number(fieldVal) - 1 >= 0 && setFieldVal((Number(fieldVal) - 1).toString()); }; return ( @@ -63,11 +57,11 @@ function RenderPluviometerInput({ > setFieldTouched(name)} onChangeText={(val) => { setFieldVal(val); }} - width={width} value={fieldVal.toString()} {...otherProps} /> @@ -79,7 +73,6 @@ function RenderPluviometerInput({ }} style={{ paddingLeft: 4, - paddingBottom: 8, paddingRight: 1.5, }} > @@ -92,7 +85,6 @@ function RenderPluviometerInput({ }} style={{ paddingLeft: 1.5, - paddingBottom: 8, paddingRight: 16, }} > @@ -109,6 +101,7 @@ function AppFormField({ flex = 0, paddingLeft = 16, paddingRight = 16, + numberOfLines = 1, ...otherProps }) { const { @@ -130,6 +123,7 @@ function AppFormField({ > {name != "pluviometer" ? ( setFieldTouched(name)} onChangeText={handleChange(name)} width={width} diff --git a/src/app/config/styles.js b/src/app/config/styles.js index 66e3f35..2ae5185 100644 --- a/src/app/config/styles.js +++ b/src/app/config/styles.js @@ -9,4 +9,17 @@ export default { fontSize: 18, fontFamily: Platform.OS === "android" ? "Roboto" : "Avenir", }, -}; \ No newline at end of file + shadow: { + // IOS shadow config + shadowColor: "#000", + shadowOffset: { + width: 0, + height: 2, + }, + shadowOpacity: 0.25, + shadowRadius: 3.84, + + // Android shadow config + elevation: 5, + }, +}; diff --git a/src/app/screens/ActivateInstitutionCode.js b/src/app/screens/ActivateInstitutionCode.js index 2e45b4b..3ffb024 100644 --- a/src/app/screens/ActivateInstitutionCode.js +++ b/src/app/screens/ActivateInstitutionCode.js @@ -40,7 +40,7 @@ function Header() { ); } -function Institution({ user, institutionRole }) { +function Institution({ user }) { const institutionMap = { E: "Escola", D: "Defesa Civil", @@ -81,7 +81,7 @@ function Institution({ user, institutionRole }) { size={30} color={colors.primary} /> - {roleMap[user.role]} + {roleMap[user?.roles[0]]} ); @@ -110,7 +110,7 @@ function ValidateCode({ user }) { flex={1} maxLength={36} name="code" - numberOfLines={2} + // numberOfLines={1} placeholder="Digite o código de ativação" /> diff --git a/src/app/screens/LoginScreen.js b/src/app/screens/LoginScreen.js index 8c067ba..80e2e17 100644 --- a/src/app/screens/LoginScreen.js +++ b/src/app/screens/LoginScreen.js @@ -119,7 +119,6 @@ export default function LoginScreen(props) { maxLength={12} name="name" keyboardType="numeric" - numberOfLines={2} placeholder="Número de telefone celular" /> @@ -129,7 +128,6 @@ export default function LoginScreen(props) { maxLength={12} name="password" secureTextEntry={true} - numberOfLines={2} placeholder="Senha" /> diff --git a/src/app/screens/PluviometerSharingDataScreen.js b/src/app/screens/PluviometerSharingDataScreen.js index 2852ae3..9439b3f 100644 --- a/src/app/screens/PluviometerSharingDataScreen.js +++ b/src/app/screens/PluviometerSharingDataScreen.js @@ -68,7 +68,7 @@ function PluviometerSharingDataScreen(props) { @@ -397,7 +396,6 @@ export default function RegisterScreen(props) { flex={1} maxLength={12} name="number" - numberOfLines={2} placeholder="Digite o número de telefone celular" paddingRight={2} /> @@ -410,7 +408,6 @@ export default function RegisterScreen(props) { maxLength={12} name="password" secureTextEntry={true} - numberOfLines={2} placeholder="Digite a senha" paddingRight={2} /> @@ -423,7 +420,6 @@ export default function RegisterScreen(props) { maxLength={12} name="confirmPassword" secureTextEntry={true} - numberOfLines={2} placeholder="Repita a senha" paddingRight={2} /> @@ -468,7 +464,6 @@ export default function RegisterScreen(props) { flex={1} maxLength={12} name="institutionName" - numberOfLines={2} placeholder="Digite o nome da instituição" paddingRight={2} /> @@ -494,7 +489,6 @@ export default function RegisterScreen(props) { flex={1} maxLength={255} name="secQuestionAns" - numberOfLines={2} placeholder="Degite a resposta à pergunta" paddingRight={2} paddingLeft={2} diff --git a/src/app/screens/SharingFloodZonesScreen.js b/src/app/screens/SharingFloodZonesScreen.js index 87c4933..7dc5d16 100644 --- a/src/app/screens/SharingFloodZonesScreen.js +++ b/src/app/screens/SharingFloodZonesScreen.js @@ -123,7 +123,7 @@ function SharingFloodZonesScreen(props) { maxLength={255} multiline name="description" - numberOfLines={3} + numberOfLines={2} placeholder="Escreva um comentário (Opcional)..." />