FormTextInput.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {StyleSheet, Text, View} from 'react-native';
  2. import {TextInput} from 'react-native-paper'
  3. import React from 'react';
  4. import colors from '../../theme/colors';
  5. import fonts from '../../theme/fonts';
  6. const FormTextInput = props => {
  7. const {title, placeholder, value, onChangeText, multiline } = props;
  8. return (
  9. <View style={styles.inputContainer}>
  10. <View style={styles.header}>
  11. <Text style={styles.inputTitleText}>{title}</Text>
  12. <Text style={styles.requiredSymbol}>*</Text>
  13. </View>
  14. <TextInput
  15. editable
  16. mode='outlined'
  17. placeholder={placeholder ?? 'Title'}
  18. placeholderTextColor={colors.grayShade_300}
  19. dense
  20. style={{
  21. fontFamily: fonts.type.medium,
  22. fontSize: fonts.getSize(11),
  23. paddingVertical: 2,
  24. paddingHorizontal: 4,
  25. }}
  26. outlineStyle={{
  27. borderRadius: 4,
  28. }}
  29. contentStyle={{
  30. fontFamily: fonts.type.regular,
  31. fontSize: fonts.getSize(14),
  32. color: colors.gray,
  33. height: multiline ? 128 : 40
  34. }}
  35. left={() => (
  36. <IonIcon name="search-outline" size={24} color={colors.black} />
  37. )}
  38. right={() => <List.Icon icon={'search'} color={colors.black} />}
  39. activeOutlineColor={colors.grayShade_300}
  40. activeUnderlineColor={colors.grayShade_300}
  41. outlineColor={colors.grayShade_300}
  42. cursorColor={colors.secondaryColor}
  43. selectionColor={colors.secondaryColor}
  44. onChangeText={onChangeText}
  45. onSubmitEditing={null}
  46. value={value}
  47. multiline={multiline}
  48. />
  49. </View>
  50. );
  51. };
  52. export default FormTextInput;
  53. const styles = StyleSheet.create({
  54. inputContainer: {
  55. paddingTop: 4
  56. },
  57. inputTitleText: {
  58. fontFamily: fonts.type.semibold,
  59. color: colors.grayShade_200,
  60. },
  61. requiredSymbol: {
  62. fontFamily: fonts.type.semibold,
  63. color: colors.primaryColor,
  64. marginLeft: 1
  65. },
  66. header: {
  67. flexDirection: 'row'
  68. },
  69. });