20 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
| import { InputFieldProps } from "@/types/type";
 | |
| import { KeyboardAvoidingView, Text, TouchableWithoutFeedback, View ,Image, TextInput, Platform, Keyboard} from "react-native";
 | |
| import tw from "twrnc";
 | |
| const InputField=({
 | |
|     label,labelStyle,icon, secureTextEntry=false, containerStyle,inputStyle,iconStyle,style,...props
 | |
| }:InputFieldProps)=>(
 | |
|  <KeyboardAvoidingView behavior={Platform.OS == "ios"? "padding":"height"}>
 | |
|     <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
 | |
|         <View style={tw`my-2 w-full`}>
 | |
|         <Text style={tw.style(`text-lg font-JakartaSemiBold mb-3 ${labelStyle}`)}>{label}</Text>
 | |
|         <View style={tw.style(`flex flex-row justify-start items-center relative bg-neutral-100 rounded-full border-neutral-100 focus:border-primary-500 ${containerStyle}`)}>
 | |
|         {icon && (<Image source={icon} style={tw.style(`w-6 h-6 ml-4 ${iconStyle}`)} /> 
 | |
|         )}
 | |
|         <TextInput style={tw.style(`rounded-full p-4 font-JakartaSemiBold text-[15px] flex-1 ${inputStyle} text-left`)} secureTextEntry={secureTextEntry}{...props}/>
 | |
|         </View>
 | |
|         </View>
 | |
|     </TouchableWithoutFeedback>
 | |
|  </KeyboardAvoidingView>
 | |
| )
 | |
| export default InputField; |