| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import React from "react";
- import {
- View,
- Text,
- TouchableOpacity,
- TextInput,
- StyleSheet,
- } from "react-native";
- import { globalStyles } from "../styles/global";
- import { useTheme } from "@Styles";
-
- const InputField = ({
- label,
- icon,
- inputType,
- keyboardType,
- filedButtonLabel,
- fieldButtonFunction,
- onChangeText,
- text,
- name,
- handleBlur,
- }) => {
- const { colors } = useTheme();
- return (
- <View style={styles.textField}>
- {icon}
- {inputType === "password" ? (
- <TextInput
- name={name}
- placeholder={label}
- placeholderTextColor="#C6C6C6"
- keyboardType={keyboardType}
- style={[styles.textInput, { color: colors.textPrimary }]}
- secureTextEntry={true}
- value={text}
- onChangeText={onChangeText}
- onBlur={handleBlur}
- />
- ) : (
- <TextInput
- name={name}
- autoCapitalize="none"
- autoCorrect={false}
- placeholder={label}
- placeholderTextColor="#C6C6C6"
- keyboardType={keyboardType}
- style={[styles.textInput, { color: colors.textPrimary }]}
- value={text}
- onChangeText={onChangeText}
- onBlur={handleBlur}
- />
- )}
- <TouchableOpacity onPress={fieldButtonFunction}>
- <Text style={globalStyles.primaryBold}>{filedButtonLabel}</Text>
- </TouchableOpacity>
- </View>
- );
- };
-
- const styles = StyleSheet.create({
- textField: {
- flexDirection: "row",
- borderBottomColor: "#ccc",
- borderBottomWidth: 1,
- paddingBottom: 8,
- marginBottom: 25,
- },
- textInput: {
- flex: 1,
- paddingVertical: 0,
- fontFamily: "poppins-regular",
- },
- });
-
- export default InputField;
|