#4031·tamagui

Cached composed ref: forwarded ref only invoked once, breaks react-hook-form focus after reset

Author: hackilyCreated Jun 11, 2026Updated Jun 12, 2026

Current Behavior

The Input component doesn't provide its host input node to a forwarded ref after a react-hook-form reset re-render. This manifests with RHF no longer having the ref to the element, so focus APIs such as setFocus() and shouldFocusError are not able to focus on form inputs.

I hit this on:

The bug still reproduces on [email protected].

Expected Behavior

Control case with a plain <input> works

Using the same RHF Controller setup with a native input:

typescript
<input {...field} ref={field.ref} value={field.value ?? ''} />

RHF keeps a focusable ref after reset()

Input should re-deliver the host input node when the forwarded ref identity changes, or otherwise compose refs in a way that does not permanently close over the initial forwardedRef.

That would allow RHF to retain the focusable field ref after reset(), so the behavior of setFocus() and shouldFocusError continues to work.

Tamagui Version

v2.2.0

Platform (Web, iOS, Android)

Web, didn't check iOS or Android

Reproduction

https://github.com/hackily/tamagui-starter-free/tree/repro/rhf-reset-ref-tamagui-input

System Info

System:
    OS: macOS 15.7
    CPU: (12) arm64 Apple M2 Pro
    Memory: 136.13 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.0 - /Users/hackily/.nvm/versions/node/v24.11.0/bin/node
    Yarn: 4.5.0 - /opt/homebrew/bin/yarn
    npm: 11.6.1 - /Users/hackily/.nvm/versions/node/v24.11.0/bin/npm
    Watchman: 2025.03.10.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 149.0.7827.103
    Firefox: 151.0.3
    Safari: 18.6
  npmPackages:
    @babel/runtime: ^7.24.6 => 7.26.9 
    @biomejs/biome: ^1.9.3 => 1.9.4 
    @tamagui/cli: ^2.2.0 => 2.2.0 
    @tamagui/react-native-svg: ^2.2.0 => 2.2.0 
    @tamagui/react-native-web-lite: ^2.2.0 => 2.2.0 
    check-dependency-version-consistency: ^4.1.0 => 4.1.1 
    expo: ^54 => 54.0.31 
    husky: ^9.1.6 => 9.1.7 
    turbo: ^1.13.4 => 1.13.4 
    typescript: ~5.8.3 => 5.8.3 
    ultra-runner: ^3.10.5 => 3.10.5 
    vitest: ^2.1.1 => 2.1.9