RNJet LogoRNJet
Components

TextField

Theme-aware, feature-rich text input component for RNJet.

TextField

A fully-featured text input built on top of react-native-paper's TextInput — with theming, validation states, secure entry, bottom-sheet support, and flexible icon slots.


Props

Core

PropTypeDefaultDescription
valueanyCurrent input value
onChangeText(text: string) => voidrequiredCallback fired when text changes
defaultValuestringDefault value for uncontrolled usage
placeholderstringPlaceholder text
maxLengthanyMaximum character length
editablebooleanWhether the input is editable
disabledanyDisables the input and adjusts styling
multilineanyfalseEnables multi-line input
inputModeTextInputProps['inputMode']Controls the virtual keyboard type (e.g. numeric, email)
keyboardTypeTextInputProps['keyboardType']"default"Keyboard layout type
returnKeyTypeReturnKeyTypeOptionsReturn key label (e.g. done, next, go)
testIDstringTest identifier for e2e testing

Label & Messaging

PropTypeDefaultDescription
labelstringLabel displayed above the input
labelColorThemeTypeneutral.baseTheme color token for the label
requiredbooleanShows a red asterisk * next to the label
subLabelstringHelper text displayed below the input
subLabelStyleanyStyle override for the sub-label
errorMessagestringError text — also sets red outline
errorMessageStyleanyStyle override for the error message
successMessagestringSuccess text — also sets green outline
successMessageStyleanyStyle override for the success message
errorbooleanTriggers error state on the underlying TextInput

Icons

PropTypeDefaultDescription
leftIconanyIcon rendered on the left side of the input
leftIconColorThemeTypeneutral.baseTheme color token for the left icon
leftOnPressIconanyCallback when the left icon is pressed
rightIconanyIcon rendered on the right side of the input
iconColorThemeTypeneutral.baseTheme color token for the right icon
onPressIcon() => voidCallback when the right icon is pressed
disabledRightIconbooleanDisables interaction on the right icon
customRightTextJSX.ElementCustom element rendered in the right slot (used when no rightIcon or secure)

Styling

PropTypeDefaultDescription
borderColorThemeType"transparent"Outline border color
backgroundColorThemeTypetheme-dependentInput background (falls back to outline/disabled styles)
borderRadiusany12Corner radius of the input outline
placeholderTextColorThemeTypeneutral.secondaryColor of the placeholder text
inputTextStyleanyAdditional styles merged into the input
isNotOutlinebooleanSwitches to a filled style (no outline mode)
topnumber0marginTop for the wrapper
bottomnumber0marginBottom for the wrapper

Behavior

PropTypeDefaultDescription
securebooleanEnables secure text entry with visibility toggle
maskEntryanyfalseInitial mask state — when true, text is visible by default
onBlur(e: any) => voidCallback when the input loses focus
onFocus(e: any) => voidCallback when the input gains focus
onSubmitEditingTextInputProps['onSubmitEditing']Callback when the return key is pressed
onEndEditingTextInputProps['onEndEditing']Callback when editing ends
onPressTextInputProps['onPressOut']Callback when the input area is pressed
useBottomSheetbooleanfalseReplaces the default input with BottomSheetTextInput for use inside @gorhom/bottom-sheet

Usage

Basic text field:

<TextField
  label="Email"
  placeholder="Enter your email"
  value={email}
  onChangeText={setEmail}
/>

Required field with error:

<TextField
  label="Username"
  required
  placeholder="Pick a username"
  value={username}
  onChangeText={setUsername}
  errorMessage={errors.username}
/>

Password field with secure entry:

<TextField
  label="Password"
  secure
  placeholder="Enter your password"
  value={password}
  onChangeText={setPassword}
/>

The secure prop automatically adds a visibility toggle icon on the right side. Users can tap it to reveal or hide the password.

With icons:

<TextField
  label="Search"
  leftIcon="search"
  rightIcon="close"
  onPressIcon={handleClear}
  placeholder="Search..."
  value={query}
  onChangeText={setQuery}
/>

Success state:

<TextField
  label="Email"
  value={email}
  onChangeText={setEmail}
  successMessage="Email is available"
/>

Inside a bottom sheet:

<TextField
  label="Note"
  placeholder="Add a note..."
  value={note}
  onChangeText={setNote}
  useBottomSheet
/>

When useBottomSheet is true, the component renders BottomSheetTextInput from @gorhom/bottom-sheet instead of the default input, ensuring proper keyboard handling inside bottom sheets.

With spacing:

<TextField
  label="First Name"
  value={firstName}
  onChangeText={setFirstName}
  top={16}
  bottom={8}
/>

Validation States

The input outline changes color based on validation state:

  • Defaultneutral.secondary border
  • Errordanger.base border + error message rendered below
  • Successsuccess.base border + success message rendered below

Only one state is shown at a time. errorMessage takes priority over successMessage.


Secure Entry

When secure is true:

  1. Text is hidden by default (secureTextEntry)
  2. A visibility toggle icon appears on the right
  3. The maskEntry prop controls the initial toggle state — set to true to show text by default
  4. If a rightIcon is also provided, it takes priority over the visibility toggle

Bottom Sheet Support

React Native text inputs don't work correctly inside @gorhom/bottom-sheet by default. Set useBottomSheet={true} to swap in BottomSheetTextInput, which handles focus and keyboard interactions properly within a bottom sheet context.


Notes

  • The component width is set to screenWidth - 40 (20px padding on each side)
  • autoCapitalize is always set to "none"
  • submitBehavior is set to "blurAndSubmit" — the input blurs and fires onSubmitEditing when return is pressed
  • On Android, fontWeight is "bold"; on iOS it's "600" — this accounts for cross-platform font rendering differences
  • All other TextInputProps from react-native-paper are supported via spread

On this page