#4237·tamagui

[V2] Native modal `Sheet` can get stuck showing only its overlay: the first open waits on an animation callback and has no fallback

Author: dieguezguilleCreated Sep 28, 2026Updated Sep 28, 2026

Current Behavior

Under load, a native <Sheet modal> sometimes opens with only its overlay. The screen dims, the frame never slides in (it stays at translateY = screenSize), and the overlay swallows taps.

Cause: the first time the sheet measures itself, it jumps the frame to screenSize with setValue(screenSize, { type: 'timing', duration: 0 }, cb), and only cb turns disableAnimation off (L521–542). With the reanimated driver, cb depends on a runOnUI hop, a runOnJS hop, a setTimeout(10) and a re-render. If any of those is lost, disableAnimation stays true for the life of the instance and animateTo never runs. Closing already has a 1s fallback for this (55ecbfe49: "animation drivers may not fire onFinish"), but opening has none. 3.0.0-beta.1479.1 has the same code.

We could not tell which hop gets lost on a device. It is not the finished !== false gate: on reanimated 4, a 0ms withTiming always finishes with true.

Expected Behavior

Opening a sheet should not wait on the driver's completion callback. A fix that works with every driver:

diff
       if (hasntMeasured && screenSize && frameSize) {
         at.current = screenSize
-        animatedNumber.setValue(
-          screenSize,
-          { type: 'timing', duration: 0 },
-          () => {
-            syncAnimatedPosition(screenSize)
-            // imperfect but struggling to render properly here
-            setTimeout(() => {
-              setDisableAnimation(false)
-            }, 10)
-          }
-        )
+        animatedNumber.setValue(screenSize, { type: 'direct' })
+        syncAnimatedPosition(screenSize)
+        setTimeout(() => {
+          setDisableAnimation(false)
+        }, 10)
         return
       }

In production we ship a smaller patch that only changes timing 0 to direct and keeps the callback. It works with the reanimated, moti, motion and css drivers, but not with the v2 react-native driver, whose direct path never calls onFinish (v3-beta fixed that).

A/B in our app (Android emulator, release build, full Maestro suite): without the patch, 2 of 4 runs got stuck at the sheet; with it, 4 of 4 passed.

Tamagui Version

markdown
2.7.7 (latest), unchanged on main @ 0eb99e3 and in 3.0.0-beta.1479.1.
We also saw it on 1.144.4 with the moti driver.

Platform (Web, iOS, Android)

markdown
Native. Measured on an Android emulator, also seen in iOS simulator e2e runs. Web uses a different code path.

Reproduction

markdown
https://github.com/dieguezguille/tamagui-sheet-first-mount-repro

It only fails under load, so the jest test simulates a lost UI -> JS hop:
reanimated's official mock, with runOnJS queued instead of run inline.

pnpm install
pnpm test     # main: frame still at 844 (screenSize) after 10s, "Expected: 544, Received: 844"

git checkout with-fix && pnpm install
pnpm test     # passes

System Info

markdown
macOS 27.0 (arm64), Node 24.13.0, pnpm 11.5.2
expo 57.0.25, react-native 0.86.3, react 19.2.3, react-native-reanimated 4.5.1, react-native-worklets 0.10.1
tamagui / @tamagui/sheet / @tamagui/animations-reanimated 2.7.7
our app: expo 55, react-native 0.83.4, reanimated 4.2.1, Android emulator release build, maestro 2.10.0