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
valueany—Current input value
onChangeText(text: string) => voidrequiredCallback fired when text changes
defaultValuestring—Default value for uncontrolled usage
placeholderstring—Placeholder text
maxLengthany—Maximum character length
editableboolean—Whether the input is editable
disabledany—Disables 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
returnKeyTypeReturnKeyTypeOptions—Return key label (e.g. done, next, go)
testIDstring—Test identifier for e2e testing

Label & Messaging

PropTypeDefaultDescription
labelstring—Label displayed above the input
labelColorThemeTypeneutral.baseTheme color token for the label
requiredboolean—Shows a red asterisk * next to the label
subLabelstring—Helper text displayed below the input
subLabelStyleany—Style override for the sub-label
errorMessagestring—Error text — also sets red outline
errorMessageStyleany—Style override for the error message
successMessagestring—Success text — also sets green outline
successMessageStyleany—Style override for the success message
errorboolean—Triggers error state on the underlying TextInput

Icons

PropTypeDefaultDescription
leftIconany—Icon rendered on the left side of the input
leftIconColorThemeTypeneutral.baseTheme color token for the left icon
leftOnPressIconany—Callback when the left icon is pressed
rightIconany—Icon rendered on the right side of the input
iconColorThemeTypeneutral.baseTheme color token for the right icon
onPressIcon() => void—Callback when the right icon is pressed
disabledRightIconboolean—Disables interaction on the right icon
customRightTextJSX.Element—Custom 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
inputTextStyleany—Additional styles merged into the input
isNotOutlineboolean—Switches to a filled style (no outline mode)
topnumber0marginTop for the wrapper
bottomnumber0marginBottom for the wrapper

Behavior

PropTypeDefaultDescription
secureboolean—Enables secure text entry with visibility toggle
maskEntryanyfalseInitial mask state — when true, text is visible by default
onBlur(e: any) => void—Callback when the input loses focus
onFocus(e: any) => void—Callback 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:

  • Default — neutral.secondary border
  • Error — danger.base border + error message rendered below
  • Success — success.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