| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import React from "react";
- import {
- View,
- Text,
- TouchableOpacity,
- TextInput,
- StyleSheet,
- } from "react-native";
- import { globalStyles } from "../styles/global";
-
- const InputField = ({
- label,
- icon,
- inputType,
- keyboardType,
- filedButtonLabel,
- fieldButtonFunction,
- onChangeText,
- text
- }) => {
- return (
- <View style={styles.textField}>
- {icon}
- {inputType === "password" ? (
- <TextInput
- placeholder={label}
- keyboardType={keyboardType}
- style={styles.textInput}
- secureTextEntry={true}
- value={text}
- onChangeText={inputText => {
- if (onChangeText) {
- onChangeText(inputText);
- }
- }}
- />
- ) : (
- <TextInput
- placeholder={label}
- keyboardType={keyboardType}
- style={styles.textInput}
- value={text}
- onChangeText={inputText => {
- if (onChangeText) {
- onChangeText(inputText);
- }
- }}
- />
- )}
- <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;
|