Skip to content

Validation not triggering onBlur in React Native environment #2162

@mdnjohn

Description

@mdnjohn

Describe the bug

This is an issue I’ve encountered since my first use of TanStack Form in React Native, but I initially considered it trivial and ignored it.

In React Native, when validating with onChange, validation is triggered for all fields when handleSubmit is pressed, regardless of whether the inputs were touched or focused. The same behavior occurs with onSubmit validation.

However, with onBlur validation, pressing handleSubmit without interacting with any input does not trigger validation errors. The form also does not submit, which is expected since validation errors exist, but no errors are displayed to the user.

The onBlur validation only triggers after at least one input has been focused and then blurred (for example, by dismissing the keyboard).

I created a simple but realistic reproduction to demonstrate the issue. https://github.com/mdnjohn/tsform-rn-issue

Your minimal, reproducible example

GitHub repo

Steps to reproduce

  1. Clone the repo https://github.com/mdnjohn/tsform-rn-issue
  2. Install dependencies
  3. Run "bunx expo prebuild"
  4. Run "bun run android" and the form is present, just press "Submit" to see the validation not triggering
Ts.form.react.native.issue.webm

Expected behavior

The expected behavior is that validation errors should be triggered and displayed on submit, regardless of whether the user has focused any input fields.

Currently, when using onBlur validation in React Native, submitting the form without interacting with any input prevents the form from submitting, which indicates that the form correctly detects validation errors internally. However, no validation errors are visually displayed to the user until at least one field has been focused and blurred.

How often does this bug happen?

Every time

Screenshots or Videos

Ts.form.react.native.issue.webm

Platform

OS: Android

TanStack Form adapter

react-form

TanStack Form version

1.29.1

TypeScript version

5.9.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions