The component accepts the following props (Important & useful props are shown first and are in bold) [All props are optional]:
-
value
: Value of the input field.
-
onTextChange
: Function to call when the text changes.
-
labelText
: Text for the label.
-
isRequired
: Boolean to mark the input as required.
-
inputType
: Type of input (e.g., 'default', 'numeric', 'email-address').
-
error
: Boolean to indicate an error state.
-
errorText
: Text to display below input when there is an error.
-
mainContainerStyle
: Style object for the outermost main container.
-
inputContainerStyle
: Style object for the input container.
-
inputContainerBackgroundColor
: Color of the input container background.
-
placeholderText
: Placeholder text for the input field.
-
placeholderTextColor
: Color of the placeholder text.
-
inputStyle
: Style object for the input field.
-
inputTextColor
: Color of the input text.
-
hideLabel
: Boolean to hide the label.
-
labelTextStyle
: Style object for the label text.
-
labelTextContainerStyle
: Style object for the label text container.
-
requiredText
: Text to display instead of '*' when the input is required.
-
requiredTextStyle
: Style object for the required text.
-
requiredTextColor
: Color of the required text.
-
labelTextColor
: Color of the label text.
-
textInputProps
: Additional props for the TextInput component.
-
labelTextProps
: Additional props for the label text.
-
requiredTextProps
: Additional props for the required text.
-
mainContainerViewProps
: Additional props for the main container view.
-
inputContainerViewProps
: Additional props for the text input container view.
-
labelTextContainerViewProps
: Additional props for the label text container view.
-
characterLimit
: Maximum number of characters allowed in the input.
-
showCharacterLimit
: Boolean to show the character limit below input field.
-
autoCapitalize
: How to auto capitalize the input (e.g., 'none', 'sentences', 'words', 'characters').
-
errorTextStyle
: Style object for the error text.
-
leftIcon
: Name of the left icon (Icon used: react-native-vector-icons/FontAwesome).
-
leftIconColor
: Color of the left icon.
-
leftIconStyle
: Style object for the left icon.
-
leftIconContainerStyle
: Style object for the left icon container.
-
renderLeftIcon
: Function to render a custom left icon.
-
leftIconSource
: Source of the left icon (e.g., FontAwesome, MaterialIcons, etc.).
-
Enums:'font-awesome'
, 'font-awesome5'
, 'material'
, 'material-community'
, 'simple-line-icon'
, 'zocial'
, 'octicon'
, 'ionicon'
, 'foundation'
, 'evilicon'
, 'entypo'
, 'ant-design'
, 'feather'
, 'fontisto'
-
Usage:
<FormInput
leftIconSource="ionicon"
/>
-
leftIconSize
: Size of the left icon.
-
leftIconOnPress
: Function to call when the left icon is pressed.
-
rightIcon
: Name of the right icon (Icon used: react-native-vector-icons/FontAwesome).
-
rightIconColor
: Color of the right icon.
-
rightIconStyle
: Style object for the right icon.
-
rightIconContainerStyle
: Style object for the right icon container.
-
renderRightIcon
: Function to render a custom right icon.
-
rightIconSource
: Source of the right icon (e.g., FontAwesome, MaterialIcons, etc.).
-
Enums:'font-awesome'
, 'font-awesome5'
, 'material'
, 'material-community'
, 'simple-line-icon'
, 'zocial'
, 'octicon'
, 'ionicon'
, 'foundation'
, 'evilicon'
, 'entypo'
, 'ant-design'
, 'feather'
, 'fontisto'
-
Usage:
<FormInput
rightIconSource="ionicon"
/>
-
rightIconSize
: Size of the right icon.
-
rightIconOnPress
: Function to call when the right icon is pressed.
-
hiddenText
: Boolean to hide the text input (for password fields).
-
disabled
: Boolean to disable the input field and the datepicker functionality (if datepickerMode is set to true).
-
theme
: String to specify the theme of the input field and the datepicker. Options are light
, dark
, or system
(to automatically match the device's theme).
-
multiline
: Boolean to enable multiline input.
-
numberOfLines
: Number of lines for multiline input.
These are the date picker props (Important & useful props are shown first and are in bold) [All props are optional. For datepicker to work, you need to give the datepicker prop.]:
-
datePicker
: Boolean to enable the date picker functionality.
-
datePickerWithTime
: Boolean to include time in the date picker. It will only work in datePickerMode="single".
-
datePickerMode
: Mode of the date picker (e.g., 'single', 'range', 'multiple').
-
initialDate
: Initial date for the date picker. (For datePickeMode: single)
-
initialRange
: Initial date range for the date picker. (For datePickeMode: range)
-
initialDates
: Initial dates for the date picker. (For datePickeMode: multiple)
-
Usage:
const date_1 = new Date();
const date_2 = new Date(new Date().setDate(new Date().getDate() + 1));
const date_3 = new Date(new Date().setDate(new Date().getDate() + 5));
<FormInput
//.... Other Props
initialDates={[date_1, date_2, date_3]}
//... Other Props
/>;
-
onDateChange
: Function to call when the date changes. (For datePickeMode: single)
-
sendDateValue
: Function to call with the selected date value. (For datePickeMode: single)
-
onDateRangeChange
: Function to call when the date range changes. (For datePickeMode: range)
-
Usage:
<FormInput
onDateRangeChange={({ startDate, endDate }) => {
console.log("Start Date: ", startDate);
console.log("End Date: ", endDate);
}}
/>
-
sendDateRangeValues
: Function to call with the selected date range values. (For datePickeMode: range)
-
Usage:
<FormInput
sendDateRangeValues={(startDate, endDate) => {
console.log("Start Date: ", startDate);
console.log("End Date: ", endDate);
}}
/>
-
onDatesChange
: Function to call when the dates change. (For datePickeMode: multiple)
-
sendDatesValues
: Function to call with the selected dates values. (For datePickeMode: multiple)
-
datePlaceholder
: Placeholder text for the date picker. (If you don't give this prop, the selected date will show.)
-
disableFutureDates
: Boolean to disable future dates in the date picker.
-
disablePastDates
: Boolean to disable past dates in the date picker.
-
datePickerBackgroundColor
: Background color for the date picker.
-
showDatePickerCloseButton
: Boolean to show the close button in the date picker.
-
datePickerCloseButtonColor
: Color of the close button in the date picker.
-
firstDayOfWeek
: First day of the week in the date picker.
-
datePickerAnimationType
: Animation type for the date picker (e.g., 'zoomIn', 'slideUp', 'slideDown', slideLeft', 'slideRight', 'none').
-
animationDuration
: Custom animation duration for the transition of date picker modal.
-
hideDatePickerConfirmButton
: Boolean to hide the date picker confirm button.
-
dateFormat
: Custom format for the date / date range / dates.
-
dateTimeFormat
: Custom format for the date and time for single date if datePickerWithTime is selected.
-
selectedContainerStyle
: Style object for the selected date container in the date picker.
-
selectedTextStyle
: Style object for the selected date text in the date picker.
-
todayContainerStyle
: Style object for the today's date container in the date picker.
-
todayTextStyle
: Style object for the today's date text in the date picker.
-
weekDaysContainerStyle
: Style object for the week days names container in the date picker.
-
weekDaysTextStyle
: Style object for the week days names text in the date picker.
-
yearContainerStyle
: Style object for the years container in the date picker in the year view.
-
yearTextStyle
: Style object for the years text in the date picker in the year view.
-
activeYearContainerStyle
: Style object for the active year container in the date picker in the year view.
-
activeYearTextStyle
: Style object for the active year text in the date picker in the year view.
-
selectedYearContainerStyle
: Style object for the selected year container (Current Year) in the date picker in the year view.
-
selectedYearTextStyle
: Style object for the selected year text (Current Year) in the date picker in the year view.
-
monthContainerStyle
: Style object for the months container in the date picker in the month view.
-
monthTextStyle
: Style object for the months text in the date picker in the month view.
-
selectedMonthContainerStyle
: Style object for the selected month container in the date picker in the month view.
-
selectedMonthTextStyle
: Style object for the selected month text in the date picker in the month view.
-
datePickerLeftButtonStyle
: Style object for the left navigation button in the date picker.
-
datePickerRightButtonStyle
: Style object for the right navigation button in the date picker.
-
datePickerDayContainerStyle
: Style object for the day container in the date picker in the calendar view.
-
datePickerDayTextStyle
: Style object for the day text in the date picker in the calendar view.
-
yearSelectorTextStyle
: Style object for the year selector text in the date picker in the calendar view.
-
monthSelectorTextStyle
: Style object for the month selector text in the date picker in the calendar view.
-
timeSelectorTextStyle
: Style object for the time selector text in the date picker in the calendar view.
-
datePickerOutsideDayTextStyle
: Style object for the outside day text in the date picker in the calendar view. (e.g., days that are not in the current month).
-
timePickerIndicatorStyle
: Style object for the time picker indicator in the date picker in time view.
-
timeTextStyle
: Style object for the time text in the date picker in time view.
-
datePickerRangeStyle
: Style object for the date picker range selection in the date picker in range view.
-
datePickerProps
: Additional props for the date picker component.
-
datePickerStyles
: Additional styles for the date picker component.
-
datePlaceholderStyle
: Style object for the date placeholder text.
-
datePickerConfirmButtonStyle
: Style object for the date picker confirm button.
-
datePickerConfirmButtonTextStyle
: Style object for the date picker confirm button text.