Loading mobile/src/components/text_input/text_input.tsx +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 { Loading @@ -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, { Loading @@ -36,7 +38,7 @@ export const CustomTextInput = (props: TextInputProps) => { }; return ( <View> <View style={styles.main_container}> <View style={styles.container} > <Animated.Text style={{ Loading @@ -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} Loading @@ -67,6 +72,9 @@ export const CustomTextInput = (props: TextInputProps) => { }; const styles = StyleSheet.create({ main_container: { width: "100%", }, container: { width: "100%", borderWidth: 1, Loading Loading
mobile/src/components/text_input/text_input.tsx +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 { Loading @@ -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, { Loading @@ -36,7 +38,7 @@ export const CustomTextInput = (props: TextInputProps) => { }; return ( <View> <View style={styles.main_container}> <View style={styles.container} > <Animated.Text style={{ Loading @@ -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} Loading @@ -67,6 +72,9 @@ export const CustomTextInput = (props: TextInputProps) => { }; const styles = StyleSheet.create({ main_container: { width: "100%", }, container: { width: "100%", borderWidth: 1, Loading