From 85ed8817fae36c06076c8d05af4f23cd26ca86ca Mon Sep 17 00:00:00 2001 From: RaianRodrigues Date: Wed, 3 Apr 2024 17:31:02 -0300 Subject: [PATCH 1/8] New user update info screen ! --- src/App.js | 7 + src/app/api/auth.js | 27 +- src/app/auth/authClient.js | 4 +- src/app/navigation/AccountNavigator.js | 7 + src/app/screens/AccountScreen.js | 6 +- src/app/screens/RegisterScreen.js | 2 +- src/app/screens/UpdateUserInfoScreen.js | 636 ++++++++++++++++++++++++ 7 files changed, 678 insertions(+), 11 deletions(-) create mode 100644 src/app/screens/UpdateUserInfoScreen.js diff --git a/src/App.js b/src/App.js index ddd2d6f..a9444ef 100644 --- a/src/App.js +++ b/src/App.js @@ -50,6 +50,12 @@ export default function App() { }); } + function clearPluviometerStation() { + + setPluviometerStation(undefined) + + } + useEffect(() => { async function getNetInfo() { if (netInfo.isInternetReachable) { @@ -134,6 +140,7 @@ export default function App() { value={{ user, setUser, + clearPluviometerStation }} > diff --git a/src/app/api/auth.js b/src/app/api/auth.js index 0bf829a..e556dd3 100644 --- a/src/app/api/auth.js +++ b/src/app/api/auth.js @@ -47,7 +47,7 @@ function signup({ async function userPersonalData() { const authToken = await authStorage.getToken(); const localClient = create({ - baseURL: "https://wpd.brazilsouth.cloudapp.azure.com/auth/users", + baseURL: "https://wpdauth.pinear.com.br/users", }); localClient.setHeader("Authorization", `Bearer ${authToken}`); @@ -61,7 +61,7 @@ async function userActivation(code) { // console.log("USER NAME: " + username); const localClient = create({ - baseURL: "https://wpd.brazilsouth.cloudapp.azure.com/auth/users", + baseURL: "https://wpdauth.pinear.com.br/users", }); localClient.setHeader("Authorization", `Bearer ${authToken}`); @@ -97,16 +97,32 @@ function loginByUsernamAnswers(username, secQuestionId, secQuestionAnswer) { function updatePassword(authToken, username, password) { const localClient = create({ - baseURL: "https://wpd.brazilsouth.cloudapp.azure.com/auth/forgotpasswords", + baseURL: "https://wpdauth.pinear.com.br/forgotpasswords", }); - + localClient.setHeader("Authorization", `Bearer ${authToken}`); - + return localClient.post( `/passwordupdatebyusername?username=${username}&newPassword=${password}` ); } +async function UpdateUserInfo(authToken,defaultValue,formValues) { + + const localClient = create({ + baseURL: "https://wpdauth.pinear.com.br/users", + }); + + localClient.setHeader("Authorization", `Bearer ${authToken}`); + + const body = { + ...defaultValue, + ...formValues + }; + + return localClient.put(`/update`, body); + +} export { login, @@ -117,4 +133,5 @@ export { existUsername, loginByUsernamAnswers, updatePassword, + UpdateUserInfo, }; diff --git a/src/app/auth/authClient.js b/src/app/auth/authClient.js index 290703a..13ebf75 100644 --- a/src/app/auth/authClient.js +++ b/src/app/auth/authClient.js @@ -1,11 +1,11 @@ import { create } from "apisauce"; const authClient = create({ - baseURL: "https://wpd.brazilsouth.cloudapp.azure.com/auth/users", + baseURL: "https://wpdauth.pinear.com.br/users", }); const authChangePswdClient = create({ - baseURL: "https://wpd.brazilsouth.cloudapp.azure.com/auth/forgotpasswords" + baseURL: "https://wpdauth.pinear.com.br/forgotpasswords" }) export { authClient, authChangePswdClient}; diff --git a/src/app/navigation/AccountNavigator.js b/src/app/navigation/AccountNavigator.js index 66f52e5..8717778 100644 --- a/src/app/navigation/AccountNavigator.js +++ b/src/app/navigation/AccountNavigator.js @@ -11,6 +11,7 @@ import ActivateInstitutionCode from "../screens/ActivateInstitutionCode"; import ActivateInstitutionShowCode from "../screens/ActivateInstitutionShowCode"; import PasswordRecovery from "../screens/PasswordRecoveryScreen"; import PasswordRecoveryChangePswd from "../screens/PasswordRecoveryChangePswdScreen"; +import UpdateUserInfoScreen from "../screens/UpdateUserInfoScreen"; const Stack = createNativeStackNavigator(); @@ -92,6 +93,12 @@ const AccountNavigator = () => ( initialParams={{ authToken : "" }} options={{ headerTitle: "" }} /> + { - props.navigation.navigate("PasswordRecovery", { user: user }); + props.navigation.navigate("UpdateUserInfoScreen", { user: user }); }, }, { diff --git a/src/app/screens/RegisterScreen.js b/src/app/screens/RegisterScreen.js index acc3edd..be85663 100644 --- a/src/app/screens/RegisterScreen.js +++ b/src/app/screens/RegisterScreen.js @@ -550,7 +550,7 @@ export default function RegisterScreen(props) { - + Nome da instituição diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js new file mode 100644 index 0000000..66502b1 --- /dev/null +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -0,0 +1,636 @@ +import * as Yup from "yup"; +import colors from '../config/colors'; +import moment from "moment"; +import Screen from '../components/Screen'; +import SearchablePicker from '../components/SearchablePicker'; +import FormDatePicker from '../components/forms/FormDatePicker'; +import institutions from "../assets/institutions"; +import defaultStyles from "../config/styles"; +import constants from "../config/constants"; +import ConfirmationModal from '../components/ConfirmationModal'; +import React, { useContext, useEffect, useState } from 'react'; +import { Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; +import { Form, FormField, SubmitButton } from '../components/forms'; +import { UpdateUserInfo, login, userPersonalData } from '../api/auth'; +import { dimensions } from '../config/dimensions'; +import { MaterialCommunityIcons } from "@expo/vector-icons"; +import { useFormikContext } from 'formik'; +import { states, statesToCities } from "../assets/cities_states"; +import PasswordFormField from "../components/forms/PasswordFormField"; +import storage from "../auth/storage"; +import { AuthContext } from "../auth/context"; +import getPluviometerStation from "../hooks/usePluviometricStation"; + +//#region PICKERS + +function InstitutionNamePicker({ name }) { + const { values } = useFormikContext(); + const state = values["state"]; + const instType = values["institution"]; + const [items, setItems] = useState([]); + + useEffect(() => { + try { + if (state && instType) { + const insts = institutions[state] && institutions[state][instType]; + insts ? setItems(insts) : setItems([]); + } + } catch (e) { + console.log(e); + } + }, [state, instType]); + + return ( + + ); +} + +function SecQuestionPicker({ name }) { + const [items, setItems] = useState([ + { value: "Qual a sua cor predileta?", label: "Qual a sua cor predileta?" }, + { + value: "Qual é seu livro predileto?", + label: "Qual é seu livro predileto?", + }, + { + value: "Qual o nome da rua em que você cresceu?", + label: "Qual o nome da rua em que você cresceu?", + }, + { + value: "Qual o nome do seu bicho de estimação predileto?", + label: "Qual o nome do seu bicho de estimação predileto?", + }, + { + value: "Qual a sua comida predileta?", + label: "Qual a sua comida predileta?", + }, + { + value: "Qual é o seu país preferido?", + label: "Qual é o seu país preferido?", + }, + { + value: "Qual é a sua marca de carro predileto?", + label: "Qual é a sua marca de carro predileto?", + }, + ]); + + return ( + + ); +} + +function RolePicker({ name }) { + const [items, setItems] = useState([ + { value: "ROLE_INSTITUTION", label: "Responsável" }, + { value: "ROLE_CLIENT", label: "Não responsável" }, + ]); + + return ( + + ); +} + +function MaterialCommunityIconsCustom({ + name, + color = colors.primary, + size = 25, +}) { + return ( + + + + ); +} + +function CityPicker({ name }) { + const { values } = useFormikContext(); + const state = values["state"]; + + useEffect(() => { + state && setItems(statesToCities[state].cities); + }, [state]); + + const [items, setItems] = useState([]); + + return ( + + ); +} + +function InstitutionPicker({ name }) { + const [items, setItems] = useState([ + { value: "E", label: "Escola" }, + { value: "D", label: "Defesa civil" }, + { value: "N", label: "Não governamental" }, + { value: "O", label: "Outra" }, + { value: "X", label: "Nenhuma" }, + ]); + return ( + + ); +} + +function GenderPicker({ name }) { + const [items, setItems] = useState([ + { value: "F", label: "Feminino" }, + { value: "M", label: "Masculino" }, + { value: "N", label: "Prefiro não dizer" }, + ]); + return ( + + ); +} + +function StatePicker({ name }) { + const [items, setItems] = useState(states); + return ( + + ); +} + +function LocalDatePicker({ date, setDate, _moment }) { + const formatDate = () => date.format("DD/MM/YYYY"); + + return ( + + setDate(value)} + minimumDate={new Date(moment().subtract(110, "year"))} + date={date} + > + + + + {date != _moment + ? formatDate() + : "Selecione a data de nascimento"} + + + + + + ); +} + +//#endregion + +export default function UpdateUserInfoScreen({ route, navigation }) { + + //#region STATES + const _moment = moment(); + const [date, setDate] = useState(_moment); + const [scroll, setScroll] = useState(); + const [showModal, setShowModal] = useState(false); + const [showpasswordModal, setShowPasswordModal] = useState(false); + const [formValue, setFormValue] = useState(null); + const [modalMessage, setModalMessage] = useState(""); + const user = route.params.user; + const title = route.params.title; + const authContext = useContext(AuthContext); + //#endregion + + const defaultValue = { + active: user.active, + city: user.city, + dateofborn: user.dateofborn, + gender: user.gender, + id: user.id, + institution: user.institution, + institutiontype: user.institutiontype, + nickname: user.nickname, + securityanswer: user.securityanswer, + securityquestion: user.securityquestion, + state: user.state, + termsofusage: user.termsofusage, + }; + + const validationSchema = Yup.object().shape({ + name: Yup.string() + .required("O nome é obrigatório") + .matches(/[a-zA-Z]/, "O nome só pode conter letras"), + state: Yup.string().required("O estado é obrigatório"), + city: Yup.string().required("A cidade é obrigatória"), + institutionName: Yup.string(), + }); + + const passwordSchema = Yup.object().shape({ + password: Yup.string() + .required("A senha é obrigatória") + .min(8, "Senha muito curta, minimo 8 caracteres") + .matches(/[a-zA-Z]/, "A senha só pode conter letras"), + }); + + const ItensList = ({ icon, IconProvider, title, onPress }) => { + return ( + + + + + + {title} + + + + + + + + ) + }; + + const ListComponent = ({ navigation }) => { + + const profileItems = [ + { + icon: "lock", + IconProvider: MaterialCommunityIcons, + title: "alterar senha", + onPress: () => { + navigation.navigate("PasswordRecovery", { user: user }); + }, + } + ]; + + return ( + + {profileItems.map( + ({ icon, IconProvider, title, onPress }) => + + + + )} + + ) + } + + const PasswordModal = ({ children, show, onClose }) => { + return ( + setShowModal(false)} + > + + + + + + {children} + + + + ) + } + + + const handleUpdatUserInfo = async (password) => { + + const username = user.username; + + const parsedForm = { + securityquestion: defaultValue.securityquestion, + securityanswer: defaultValue.securityanswer, + id: defaultValue.id, + termsofusage: defaultValue.termsofusage, + city: formValue.city, + gender: formValue.gender, + institution: formValue.institutionName, + institutiontype: formValue.institution, + nickname: formValue.name, + active: defaultValue.active, + dateofborn: date.format("YYYY-MM-DD"), + state: formValue.state, + }; + + try { + + const apiResponse = await login(username, password); + + const authToken = apiResponse.data; + + const result = await UpdateUserInfo(authToken, defaultValue, parsedForm); + + if (result.status == 200) { + + storage.setToken(authToken) + + const getPersonalData = await userPersonalData() + + authContext.clearPluviometerStation() + + authContext.setUser(getPersonalData.data); + + setShowModal(true); + setModalMessage("Informações atualizadas com sucesso"); + + } else { + setShowModal(true); + setModalMessage("Algum erro inesperado ocorreu"); + } + } catch (error) { + console.error('Erro ao obter token de autenticação:', error); + setShowModal(true); + setModalMessage("Algum erro inesperado ocorreu"); + } + + }; + + return ( + + { + setShowModal(false), + navigation.goBack(); + }} + /> + + setShowPasswordModal(false)}> + +
{ + handleUpdatUserInfo(password); + setShowPasswordModal(false); + }}> + Senha* + + + + + +
+
+ +
{ + setFormValue(form); + setShowPasswordModal(true) + }} + > + { + setScroll(ref); + }} + style={{ paddingHorizontal: 20 }} + > + {title} + {/*--------------------------------------- NAME ---------------------------------------*/} + Apelido de usuário* + + + + + {/*--------------------------------------- DATEOFBORN ---------------------------------------*/} + Data de nascimento: + + + + + {/*--------------------------------------- GENDER ---------------------------------------*/} + Gênero: + + + + + {/*--------------------------------------- STATE ---------------------------------------*/} + Estado*: + + + + + {/*--------------------------------------- CITY ---------------------------------------*/} + Cidade*: + + + + + {/*--------------------------------------- INSTITUTION ---------------------------------------*/} + Tipo de instituição: + + + + + {/* --------------------------------------- INSTITUTIONNAME ---------------------------------------*/} + + Nome da instituição + + + + + + + O nome da instituição é fornecido pelo Cemaden Educação + + + {/* --------------------------------------- ROLE ---------------------------------------*/} + Vínculo institucional: + + + + + + + + + + +
+
+ ); +} + +const styles = StyleSheet.create({ + container: { + justifyContent: "center", + textAlign: "center", + }, + iconField: { + alignItems: "center", + width: "100%", + flex: 1, + flexDirection: "row", + marginTop: 12, + marginBottom: 24, + }, + title: { + fontSize: 22, + fontWeight: "bold", + textAlign: "center", + color: colors.black, + marginVertical: 24 + }, + textSubtitle: { + textAlign: "center", + fontSize: dimensions.text.tertiary, + }, + labelStyle: { + fontSize: dimensions.text.secondary, + fontWeight: "bold", + textAlign: "left", + color: colors.secondary, + }, + warningText: { + color: colors.primary, + fontSize: dimensions.text.primary, + textAlign: "left", + marginBottom: 24, + }, +}); \ No newline at end of file -- 2.25.1 From 714ebd008e72035adafcfb53a208f8f02fe0fcc9 Mon Sep 17 00:00:00 2001 From: RaianRodrigues Date: Fri, 5 Apr 2024 18:32:41 -0300 Subject: [PATCH 2/8] Fix: Navigation to login, Pop-up does not disappear. --- .../PasswordRecoveryChangePswdScreen.js | 7 ++- src/app/screens/PasswordRecoveryScreen.js | 2 + src/app/screens/UpdateUserInfoScreen.js | 44 +------------------ 3 files changed, 8 insertions(+), 45 deletions(-) diff --git a/src/app/screens/PasswordRecoveryChangePswdScreen.js b/src/app/screens/PasswordRecoveryChangePswdScreen.js index 66b9a6e..d5cb841 100644 --- a/src/app/screens/PasswordRecoveryChangePswdScreen.js +++ b/src/app/screens/PasswordRecoveryChangePswdScreen.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useContext, useState } from "react"; import { StyleSheet, View, Text } from "react-native"; import * as Yup from "yup"; @@ -9,6 +9,7 @@ import PasswordFormField from "../components/forms/PasswordFormField"; import ConfirmationModal from "../components/ConfirmationModal"; import { updatePassword } from "../api/auth"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; +import { AuthContext } from "../auth/context"; const validationSchema = Yup.object().shape({ password: Yup.string() @@ -24,6 +25,7 @@ const validationSchema = Yup.object().shape({ export default function PasswordRecoveryChangePswd({ navigation, route }) { const authToken = route.params.authToken; const username = route.params.username; + const authContext = useContext(AuthContext); const [confirmatioModalData, setConfirmatioModalData] = useState({ show: false, @@ -44,7 +46,8 @@ export default function PasswordRecoveryChangePswd({ navigation, route }) { message: "Senha alterada com sucesso", show: true, onConfirmAction: () => { - navigation.navigate("Login"); + authContext.setUser(); + navigation.popToTop(); }, }); break; diff --git a/src/app/screens/PasswordRecoveryScreen.js b/src/app/screens/PasswordRecoveryScreen.js index 560d82f..e6b9de4 100644 --- a/src/app/screens/PasswordRecoveryScreen.js +++ b/src/app/screens/PasswordRecoveryScreen.js @@ -136,6 +136,8 @@ export default function PasswordRecovery({ navigation, route }) { setConfirmatioModalData({ show: false })} /> diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index 66502b1..b92764a 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -19,7 +19,6 @@ import { states, statesToCities } from "../assets/cities_states"; import PasswordFormField from "../components/forms/PasswordFormField"; import storage from "../auth/storage"; import { AuthContext } from "../auth/context"; -import getPluviometerStation from "../hooks/usePluviometricStation"; //#region PICKERS @@ -59,47 +58,6 @@ function InstitutionNamePicker({ name }) { ); } -function SecQuestionPicker({ name }) { - const [items, setItems] = useState([ - { value: "Qual a sua cor predileta?", label: "Qual a sua cor predileta?" }, - { - value: "Qual é seu livro predileto?", - label: "Qual é seu livro predileto?", - }, - { - value: "Qual o nome da rua em que você cresceu?", - label: "Qual o nome da rua em que você cresceu?", - }, - { - value: "Qual o nome do seu bicho de estimação predileto?", - label: "Qual o nome do seu bicho de estimação predileto?", - }, - { - value: "Qual a sua comida predileta?", - label: "Qual a sua comida predileta?", - }, - { - value: "Qual é o seu país preferido?", - label: "Qual é o seu país preferido?", - }, - { - value: "Qual é a sua marca de carro predileto?", - label: "Qual é a sua marca de carro predileto?", - }, - ]); - - return ( - - ); -} - function RolePicker({ name }) { const [items, setItems] = useState([ { value: "ROLE_INSTITUTION", label: "Responsável" }, @@ -284,7 +242,7 @@ export default function UpdateUserInfoScreen({ route, navigation }) { .matches(/[a-zA-Z]/, "O nome só pode conter letras"), state: Yup.string().required("O estado é obrigatório"), city: Yup.string().required("A cidade é obrigatória"), - institutionName: Yup.string(), + institutionName: Yup.string().required("A instituição é obrigatória"), }); const passwordSchema = Yup.object().shape({ -- 2.25.1 From 1db7a37861b1b254409619e2a7d69bb2be5248b0 Mon Sep 17 00:00:00 2001 From: bobmw Date: Sat, 6 Apr 2024 17:28:10 -0300 Subject: [PATCH 3/8] fix: remove-required-institucional-name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove obrigatóriedade do nome da instituição --- src/app/screens/UpdateUserInfoScreen.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index b92764a..45dfd59 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -241,8 +241,7 @@ export default function UpdateUserInfoScreen({ route, navigation }) { .required("O nome é obrigatório") .matches(/[a-zA-Z]/, "O nome só pode conter letras"), state: Yup.string().required("O estado é obrigatório"), - city: Yup.string().required("A cidade é obrigatória"), - institutionName: Yup.string().required("A instituição é obrigatória"), + city: Yup.string().required("A cidade é obrigatória") }); const passwordSchema = Yup.object().shape({ -- 2.25.1 From 83af2bc7d0d390145e50a87771637f492cffe886 Mon Sep 17 00:00:00 2001 From: bobmw Date: Sun, 7 Apr 2024 11:33:34 -0300 Subject: [PATCH 4/8] fix: set-city-field-required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configurando state da Cidade para vazio quando mudado o Estado, disparando assim mensagem de obrigatório --- src/app/screens/UpdateUserInfoScreen.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index 45dfd59..429ad9c 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -88,15 +88,15 @@ function MaterialCommunityIconsCustom({ } function CityPicker({ name }) { - const { values } = useFormikContext(); + const [items, setItems] = useState([]); + const { values, setValues } = useFormikContext(); const state = values["state"]; useEffect(() => { state && setItems(statesToCities[state].cities); + setValues({ ...values, city: "" }); }, [state]); - const [items, setItems] = useState([]); - return ( Date: Sun, 7 Apr 2024 11:43:38 -0300 Subject: [PATCH 5/8] fix(RegisterScreen): set-city-field-required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configurando state da Cidade para vazio quando mudado o Estado, disparando assim mensagem de obrigatório --- src/app/screens/RegisterScreen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/screens/RegisterScreen.js b/src/app/screens/RegisterScreen.js index be85663..99f74f6 100644 --- a/src/app/screens/RegisterScreen.js +++ b/src/app/screens/RegisterScreen.js @@ -161,11 +161,12 @@ function StatePicker({ name }) { } function CityPicker({ name }) { - const { values } = useFormikContext(); + const { values, setValues } = useFormikContext(); const state = values["state"]; useEffect(() => { state && setItems(statesToCities[state].cities); + setValues({ ...values, city: "" }); }, [state]); const [items, setItems] = useState([]); -- 2.25.1 From 3a2e30bf2d2e75c15997ca10ce4a39b970b5673b Mon Sep 17 00:00:00 2001 From: bobmw Date: Sun, 7 Apr 2024 17:10:12 -0300 Subject: [PATCH 6/8] fix: persist city in initial state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mantendo a cidade selecionada e só deixando vazio caso mude de estado --- src/app/screens/UpdateUserInfoScreen.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index 429ad9c..384c066 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -89,12 +89,20 @@ function MaterialCommunityIconsCustom({ function CityPicker({ name }) { const [items, setItems] = useState([]); + const [isInitialRender, setIsInitialRender] = useState(true); + const { values, setValues } = useFormikContext(); + const state = values["state"]; useEffect(() => { - state && setItems(statesToCities[state].cities); - setValues({ ...values, city: "" }); + if (isInitialRender) { + state && setItems(statesToCities[state].cities); + setIsInitialRender(false); + } else { + state && setItems(statesToCities[state].cities); + setValues({ ...values, city: "" }); + } }, [state]); return ( -- 2.25.1 From fc2ea703bd5d2b5adedbe1801c04ae157cead66f Mon Sep 17 00:00:00 2001 From: bobmw Date: Sun, 7 Apr 2024 17:56:47 -0300 Subject: [PATCH 7/8] fix: render user date of burn on front-end Renderizando data de nascimento do usuario --- src/app/screens/UpdateUserInfoScreen.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index 384c066..5794f75 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -229,6 +229,10 @@ export default function UpdateUserInfoScreen({ route, navigation }) { const authContext = useContext(AuthContext); //#endregion + useEffect(() => { + setDate(moment(user.dateofborn)); + }, []); + const defaultValue = { active: user.active, city: user.city, -- 2.25.1 From 18dd350d7280f1d33b1be19b553523405170b1b7 Mon Sep 17 00:00:00 2001 From: bobmw Date: Sun, 7 Apr 2024 20:26:13 -0300 Subject: [PATCH 8/8] feat: setting new mode in date picker modo mais intuitivo para date picker --- src/app/components/DatePicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/DatePicker.js b/src/app/components/DatePicker.js index de10ff3..62d6109 100644 --- a/src/app/components/DatePicker.js +++ b/src/app/components/DatePicker.js @@ -121,7 +121,7 @@ export default function DatePicker(props) { return moment(selectedDate).format("HH:mm"); } }} //formatar a data e hora do selected date - display={Platform.OS === "ios" ? "spinner" : "default"} + display={"spinner"} onChange={Platform.OS === "ios" ? onChange : androidOnChange} /> ); -- 2.25.1