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

medhira-rn-typescript-hooks

v0.1.1

Published

MEDHIRA - React Native TypeScript validation hooks

Readme

medhira-rn-typescript-hooks

Typed React Native validation hooks for forms, selects, and checkboxes

npm package npm downloads License: MIT Documentation TypeScript React Native

Engineering Intelligence Across Everything

InstallationHooksArchitectureDocumentationContributing


Why this package?

| Benefit | Description | | --- | --- | | Form-ready hooks | Validation logic for text inputs, selects, and checkboxes | | Typed API | Exported TypeScript options and result interfaces | | Consistent behavior | Shared state management via medhira-react-typescript-hooks | | Custom errors | Override every validation message | | Zero native code | Pure JavaScript hooks — works with Expo and React Native CLI | | Tree-shakeable | sideEffects: false with dual ESM/CJS builds |

Installation

npm install medhira-rn-typescript-hooks medhira-react-typescript-hooks react react-native
# Expo
npx expo install medhira-rn-typescript-hooks medhira-react-typescript-hooks

Peer dependency: This library requires medhira-react-typescript-hooks (>=0.1.0).

Quick Start

import { TextInput, View, Text } from 'react-native';
import { useValidateForm } from 'medhira-rn-typescript-hooks';

const EmailField = () => {
  const form = useValidateForm({
    type: 'string',
    label: 'Email',
    isRequired: true,
    keyboard: 'email-address',
    validationPattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
    validError: 'Please enter a valid email',
  });

  return (
    <View>
      <TextInput
        value={form.value ?? ''}
        onChangeText={form.valueChangeHandler}
        onFocus={form.valueFocusHandler}
        onBlur={form.valueBlurHandler}
        editable={form.inputIsEditable}
      />
      {form.hasError && <Text>{form.customError}</Text>}
    </View>
  );
};

Hooks

| Hook | Purpose | | --- | --- | | useValidateForm | String/number input validation with regex, min/max, and length rules | | useValidateSelect | Single or multiple select validation with min/max selections | | useValidateCheckBox | Checkbox validation with required support and custom colors |

Architecture

flowchart TB
    subgraph app["Your React Native App"]
        FORM["Form Screen"]
    end

    subgraph pkg["medhira-rn-typescript-hooks"]
        UVF["useValidateForm"]
        UVS["useValidateSelect"]
        UVC["useValidateCheckBox"]
    end

    subgraph peer["medhira-react-typescript-hooks (peer)"]
        UDR["useDefaultReducer"]
    end

    FORM --> UVF & UVS & UVC
    UVF & UVS & UVC --> UDR
sequenceDiagram
    participant User
    participant Input as TextInput
    participant Hook as useValidateForm
    participant State as patchState

    User->>Input: type / focus / blur
    Input->>Hook: valueChangeHandler / focus / blur
    Hook->>State: update value + focus flags
    Hook->>Hook: run validation rules
    Hook->>State: set isValid + customError
    Hook-->>Input: value, hasError, customError

Published entry point: medhira-rn-typescript-hooks only. Do not import from internal build paths.

useValidateForm

Form validation hook for TextInput fields.

import { useValidateForm } from 'medhira-rn-typescript-hooks';

const form = useValidateForm({
  type: 'string',
  label: 'Email',
  isRequired: true,
  keyboard: 'email-address',
  minLength: 5,
  maxLength: 100,
  validationPattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
  validError: 'Please enter a valid email',
});

| Option | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | type | 'string' \| 'number' | Yes | — | Field data type | | label | string | Yes | — | Field label | | isRequired | boolean | Yes | — | Whether the field is required | | keyboard | string | No | 'default' | Keyboard type | | minValue / maxValue | number | No | — | Number range (number type) | | minLength / maxLength | number | No | — | Length range (string type) | | defaultValue | string \| number | No | — | Initial value | | validationPattern | RegExp | No | — | Regex validation | | valueChangeCallback | (text: string) => void | No | — | Called on value change |

useValidateSelect

Dropdown/select validation with single and multiple selection support.

import { useValidateSelect } from 'medhira-rn-typescript-hooks';

const select = useValidateSelect({
  itemsList: [
    { label: 'Option 1', value: '1' },
    { label: 'Option 2', value: '2' },
  ],
  isRequired: true,
  multiple: false,
  onChangeValueCallBack: (value) => {
    // handle selection
  },
});

For native pickers, use @react-native-picker/picker or your preferred select component.

useValidateCheckBox

Checkbox validation with required support and customizable colors.

import { useValidateCheckBox } from 'medhira-rn-typescript-hooks';

const checkbox = useValidateCheckBox({
  isRequired: true,
  value: false,
  validError: 'Please accept the terms',
  checkedColor: '#4CAF50',
  uncheckedColor: '#9E9E9E',
});

Complete Form Example

import { View, TextInput, Text, Button } from 'react-native';
import {
  useValidateForm,
  useValidateSelect,
  useValidateCheckBox,
} from 'medhira-rn-typescript-hooks';

const SignUpForm = () => {
  const email = useValidateForm({
    type: 'string',
    label: 'Email',
    isRequired: true,
    validationPattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
  });

  const country = useValidateSelect({
    itemsList: [
      { label: 'USA', value: 'us' },
      { label: 'UK', value: 'uk' },
    ],
    isRequired: true,
  });

  const terms = useValidateCheckBox({
    isRequired: true,
    value: false,
  });

  const canSubmit = email.isValid && country.isValid && terms.isValid;

  return (
    <View>
      <TextInput
        value={email.value ?? ''}
        onChangeText={email.valueChangeHandler}
        onBlur={email.valueBlurHandler}
      />
      {email.hasError && <Text>{email.customError}</Text>}

      {/* Wire country.value to your picker component */}
      {country.hasError && <Text>{country.customError}</Text>}

      {/* Wire terms.value to your checkbox component */}
      {terms.hasError && <Text>{terms.customError}</Text>}

      <Button title="Submit" disabled={!canSubmit} onPress={() => {}} />
    </View>
  );
};

Documentation

Full API reference, architecture diagrams, and examples:

https://medhira-rn-typescript-hooks.readthedocs.io

Requirements

Contributing

Contributions are welcome! See the documentation for development setup.

git clone https://github.com/HELLOMEDHIRA/medhira-rn-typescript-hooks.git
cd medhira-rn-typescript-hooks
npm install
npm test
npm run build

Sponsor & Support

License

MIT


Made with passion by MEDHIRA