npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-form-textinput

v1.0.1

Published

TextInput integrated with react-hook-form Controller for React Native

Readme

react-native-form-textinput

A React Native TextInput wired to react-hook-form Controller, with optional label, validation styling, icons, and common input helpers.

Why use this?

With react-hook-form alone, each field tends to repeat the same pieces: wrapping Controller, passing control and name, wiring rules, surfacing formState.errors, and styling the field when something is invalid. This component folds that into one place so a typical field is a single JSX element with the props you care about (name, control, label, rules, error, plus normal TextInput props) instead of re‑implementing the same pattern on every screen.

Requirements

  • React >=18
  • React Native >=0.70
  • react-hook-form >=7

Installation

npm install react-native-form-textinput

Peer dependencies must be installed in your app:

npm install react-hook-form

Usage

import { useForm } from "react-hook-form";
import FormTextInput from "react-native-form-textinput";

type FormValues = {
  email: string;
  password: string;
};

export function LoginForm() {
  const {
    control,
    handleSubmit,
    formState: { errors },
  } = useForm<FormValues>({
    defaultValues: { email: "", password: "" },
  });

  const onSubmit = (data: FormValues) => {
    console.log(data);
  };

  return (
    <>
      <FormTextInput
        name="email"
        control={control}
        label="Email"
        rules={{ required: "Email is required" }}
        error={errors.email?.message}
        keyboardType="email-address"
      />
      <FormTextInput
        name="password"
        control={control}
        label="Password"
        secureTextEntry
        rules={{ required: "Password is required" }}
        error={errors.password?.message}
      />
      {/* ... trigger handleSubmit(onSubmit) from a button */}
    </>
  );
}

Refs

FormTextInput forwards a ref to the underlying TextInput:

import { useRef } from "react";
import { TextInput } from "react-native";
import FormTextInput from "react-native-form-textinput";

const inputRef = useRef<TextInput>(null);

<FormTextInput ref={inputRef} name="code" control={control} label="Code" />;

Props

FormTextInput extends React Native TextInput props, with these additions:

| Prop | Type | Description | | ------------------ | ----------------- | ------------------------------------------------------------------ | | name | FieldPath<T> | Required. Registered field path (typed with your form values). | | control | Control<T> | Required. Form control from useForm. | | label | string | Label above the field. Shows a * when rules.required is set. | | rules | RegisterOptions | Validation rules (same as Controller rules). | | error | string | Error message shown under the input; red border when set. | | containerStyle | ViewStyle | Outer container style. | | inputStyle | TextStyle | TextInput text/style overrides. | | leftIcon | ReactNode | Optional icon on the left inside the field. | | rightIcon | ReactNode | Optional icon on the right. | | onRightIconPress | () => void | Press handler for the right icon wrapper. | | onInputPress | () => void | Called on onPressIn and onFocus on the input. | | multiline | boolean | Default false. | | numberOfLines | number | Default 1. | | onlyNumbers | boolean | Strips non-digits and uses number-pad. Default false. | | maxLength | number | Passed through to TextInput. | | hideLabel | boolean | Hides the label row when true. Default false. |

Notes:

  • Default autoCapitalize is "none".
  • Placeholder defaults to Enter ${label} when placeholder is omitted.
  • RTL layouts use I18nManager for text alignment.

Development

npm install
npm run build

Compiled output is emitted to dist/ (prepublishOnly runs build before publish).

Tests

Automated checks use Jest with the React Native preset and Testing Library (rendering, changeText, icons, onlyNumbers). They do not replace running the UI on a simulator or device.

npm test

License

ISC