@formisch/react-native

中文文档
1.2.0发布于 2026/11/01MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 3181

The lightweight, schema-first, and fully type-safe form library for React Native

原始使用文档
文档目录7 节
  1. Highlights
  2. Example
  3. Comparison
  4. Vision
  5. Partners
  6. Feedback
  7. License

Formisch for React Native

Formisch is a schema-based, headless form library for React Native. It manages form state and validation. It is type-safe, fast by default and its bundle size is small due to its modular design. Try it out in our playground!

Formisch is also available for Angular, HonoX, Preact, Qwik, React, SolidJS, Svelte and Vue.

Highlights

  • Small bundle size starting at 2.5 kB
  • Schema-based validation with Valibot
  • Type safety with autocompletion in editor
  • Open source and fully tested with 100 % coverage
  • It's fast – re-renders only if necessary
  • Minimal, readable and well thought out API
  • Supports native TextInput fields

Example

Every form starts with the useForm hook. It initializes your form's store based on the provided Valibot schema and infers its types. Unlike the DOM frameworks, React Native has no native form element or submit event, so there is no <Form /> component and submission is triggered explicitly with handleSubmit, for example from a button's onPress or a text input's onSubmitEditing handler. You can access the state of a field with the useField hook or the <Field /> component to connect your TextInput.

import { Field, handleSubmit, useForm } from '@formisch/react-native';
import { Button, Text, TextInput, View } from 'react-native';
import * as v from 'valibot';

const LoginSchema = v.object({
  email: v.pipe(v.string(), v.email()),
  password: v.pipe(v.string(), v.minLength(8)),
});

export default function LoginScreen() {
  const loginForm = useForm({
    schema: LoginSchema,
  });

  const submitForm = handleSubmit(loginForm, (output) => console.log(output));

  return (
    <View>
      <Field of={loginForm} path={['email']}>
        {(field) => (
          <View>
            <TextInput
              {...field.props}
              value={field.input}
              autoCapitalize="none"
              keyboardType="email-address"
            />
            {field.errors && <Text>{field.errors[0]}</Text>}
          </View>
        )}
      </Field>
      <Field of={loginForm} path={['password']}>
        {(field) => (
          <View>
            <TextInput {...field.props} value={field.input} secureTextEntry />
            {field.errors && <Text>{field.errors[0]}</Text>}
          </View>
        )}
      </Field>
      <Button title="Login" onPress={submitForm} />
    </View>
  );
}

In addition, Formisch offers several functions (we call them "methods") that can be used to read and manipulate the form state. These include focus, getDeepErrorEntries, getDeepErrors, getDirtyInput, getDirtyPaths, getErrors, getInput, handleSubmit, insert, isDirty, isEdited, isTouched, isValid, move, pickDirty, remove, replace, reset, setErrors, setInput, swap and validate. These methods allow you to control the form programmatically.

Comparison

What makes Formisch unique is its framework-agnostic core, which is fully native to the framework you are using. It works by inserting framework-specific reactivity blocks when the core package is built, giving you native performance for any UI update. A modular methods API keeps bundles starting at just ~2.5 kB by only including the methods you import, and end-to-end type safety covers deeply nested paths and field arrays with TypeScript inference that stays fast even as forms grow.

For a side-by-side look at how Formisch compares to React Hook Form and TanStack Form, see the comparison guide.

Vision

My vision for Formisch is to create a framework-agnostic platform similar to Vite, but for forms — a shared core that lets the same mental model and codebase work natively across every modern UI framework.

Partners

Thanks to our partners who support the development! Join them and contribute to the sustainability of open source software!

Partners of Formisch

Feedback

Find a bug or have an idea how to improve the library? Please fill out an issue. Together we can make forms even better!

License

This project is available free of charge and licensed under the MIT license.

版本与发布记录

@formisch/react-native 共发布 5 个版本,首次发布于 2026/07/30;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.0latest2026/11/0114 天前
1.1.12026/10/2620 天前
1.1.02026/09/082 个月前
1.0.02026/08/202 个月前
0.1.02026/07/303 个月前

关于 @formisch/react-native 的常见问题

@formisch/react-native 是什么?

The lightweight, schema-first, and fully type-safe form library for React Native

如何安装 @formisch/react-native?

在项目目录运行 npm install @formisch/react-native,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18 <20)、valibot(>=1.4.1 <2)、react-native(>=0.73 <1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@formisch/react-native 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@formisch/react-native 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@formisch/react-native 可以商用吗?

@formisch/react-native 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@formisch/react-native 的下载量有多少?

根据 npm 官方下载统计,@formisch/react-native 在 2026/10/16 – 2026/11/14 这 30 天内被下载 3,181 次,日均约 106 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@formisch/react-native 还在维护吗?

最新版本 1.2.0 发布于 2026/11/01(14 天前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/07/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。