You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import React from "react";
  2. import {
  3. View,
  4. Text,
  5. TouchableOpacity,
  6. TextInput,
  7. StyleSheet,
  8. } from "react-native";
  9. import { globalStyles } from "../styles/global";
  10. const InputField = ({
  11. label,
  12. icon,
  13. inputType,
  14. keyboardType,
  15. filedButtonLabel,
  16. fieldButtonFunction,
  17. onChangeText,
  18. text,
  19. name,
  20. handleBlur
  21. }) => {
  22. return (
  23. <View style={styles.textField}>
  24. {icon}
  25. {inputType === "password" ? (
  26. <TextInput
  27. name={name}
  28. placeholder={label}
  29. placeholderTextColor="#C6C6C6"
  30. keyboardType={keyboardType}
  31. style={styles.textInput}
  32. secureTextEntry={true}
  33. value={text}
  34. onChangeText={onChangeText}
  35. onBlur={handleBlur}
  36. />
  37. ) : (
  38. <TextInput
  39. name={name}
  40. placeholder={label}
  41. placeholderTextColor="#C6C6C6"
  42. keyboardType={keyboardType}
  43. style={styles.textInput}
  44. value={text}
  45. onChangeText={onChangeText}
  46. onBlur={handleBlur}
  47. />
  48. )}
  49. <TouchableOpacity onPress={fieldButtonFunction}>
  50. <Text style={globalStyles.primaryBold}>{filedButtonLabel}</Text>
  51. </TouchableOpacity>
  52. </View>
  53. );
  54. };
  55. const styles = StyleSheet.create({
  56. textField: {
  57. flexDirection: "row",
  58. borderBottomColor: "#ccc",
  59. borderBottomWidth: 1,
  60. paddingBottom: 8,
  61. marginBottom: 25,
  62. },
  63. textInput: {
  64. flex: 1,
  65. paddingVertical: 0,
  66. fontFamily: "poppins-regular",
  67. },
  68. });
  69. export default InputField;