diff --git a/src/components/TouchableData.js b/src/components/TouchableData.js index e1db231..cf99dd1 100644 --- a/src/components/TouchableData.js +++ b/src/components/TouchableData.js @@ -1,13 +1,18 @@ - //TouchableData.js -import React from 'react'; -import { Text, StyleSheet, Dimensions, View, TouchableOpacity } from 'react-native'; +import React,{useState} from 'react'; +import { Text, StyleSheet, Dimensions, View, TouchableOpacity, TextInput } from 'react-native'; import { theme } from "../../constants"; import StyledText from "../utils/StyledText"; const { height } = Dimensions.get('window'); import { Ionicons } from "@expo/vector-icons"; -const TouchableData = ({ label, icon, value }) => { +const TouchableData = ({ label, icon, value, fieldName }) => { + const [valueEdit, setValueEdit] = useState(value); + + const handleEditPress = () => { + // firebase.database().ref(`cobradores/${idCobrador}/${fieldName}`).set(valueEdit); + }; + return ( @@ -16,10 +21,20 @@ const TouchableData = ({ label, icon, value }) => { {label} - {value} + { + if(name.length <= 30 && name.match("^[a-zA-Z ]*$")){ + setValueEdit(name); + }} + } + defaultValue={value} + value={valueEdit} + keyboardType="default" + /> - + Editar @@ -28,7 +43,7 @@ const TouchableData = ({ label, icon, value }) => { const styles = StyleSheet.create({ container: { - backgroundColor: 'white', + backgroundColor: theme.colors.primary, paddingVertical: 10, paddingHorizontal: 15, marginVertical: 2, @@ -36,7 +51,7 @@ const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', - borderWidth: 2, + borderWidth: 1, borderRadius: 20, borderColor: theme.colors.otherWhite, display: 'flex', diff --git a/src/screens/ProfileScreen.js b/src/screens/ProfileScreen.js index 047ed34..a38d79c 100644 --- a/src/screens/ProfileScreen.js +++ b/src/screens/ProfileScreen.js @@ -1,5 +1,5 @@ //ProfileScreen.js -import React, { useState } from "react"; +import React, { useState, useCallback } from "react"; import { Text, TouchableOpacity, View, StyleSheet, Dimensions, Image, SafeAreaView } from "react-native"; import StyledText from "../utils/StyledText"; import { theme } from "../../constants"; @@ -7,41 +7,64 @@ import imgprofile from "../assets/imgprofile.png"; import TouchableData from "../components/TouchableData"; import Icon from "react-native-vector-icons/AntDesign"; import { useNavigation } from "@react-navigation/native"; +import Cascading from "../animation/CascadingFadeInView"; +import { useFocusEffect } from "@react-navigation/native"; +// import { database } from "../../config/firebase"; +// import { collection, getDocs } from 'firebase/firestore'; const screenWidth = Dimensions.get('window').width; const ProfileScreen = ({ route }) => { const { username } = route.params; const navigation = useNavigation(); + const [animationKey, setAnimationKey] = useState(Date.now()); + + useFocusEffect( + useCallback(() => { + setAnimationKey(Date.now()); + }, []) + ); return ( + navigation.goBack()}> + Perfil {username} Cobrador - + + + + + + + + )