Commit bcdb9edb authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Se cambiaron los estilos del textInput

parent 274a8416
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
import { useEffect, useRef } from "react";
import { TextInput, Text, StyleSheet, View, Animated } from "react-native";
import { TextInput, Text, StyleSheet, View, Animated, TouchableOpacity } from "react-native";
import { LIGTHT_THEME } from "../../constants/theme";

interface TextInputProps {
@@ -10,11 +10,13 @@ interface TextInputProps {
  onBlur?: () => void;
  errors?: string;
  type?: any;
  editable?: boolean;
}

export const CustomTextInput = (props: TextInputProps) => {
  const { isPassword, label, type, onBlur, errors, ...rest } = props;
  const labelFocusAnimation = useRef(new Animated.Value(0)).current;
  const { isPassword, label, type, onBlur, errors, value, editable,...rest } = props;
  const labelFocusAnimation = useRef(new Animated.Value(value.length > 0 ? 1 : 0)).current;
  const inputRef = useRef<TextInput>(null);

  const handleFocus = () => {
    Animated.timing(labelFocusAnimation, {
@@ -36,7 +38,7 @@ export const CustomTextInput = (props: TextInputProps) => {
  };

  return (
    <View>
    <View style={styles.main_container}>
      <View style={styles.container} >
        <Animated.Text
          style={{
@@ -51,6 +53,9 @@ export const CustomTextInput = (props: TextInputProps) => {
        </Animated.Text>
        <TextInput
          {...rest}
          editable={editable}
          ref={inputRef}
          value={value}
          textContentType={type}
          onFocus={handleFocus}
          onBlur={handleBlur}
@@ -67,6 +72,9 @@ export const CustomTextInput = (props: TextInputProps) => {
};

const styles = StyleSheet.create({
  main_container: {
    width: "100%",
  },
  container: {
    width: "100%",
    borderWidth: 1,