[popover] On web with the Reanimated driver, a popover's first open skips its enter animation
Current Behavior
On web with @tamagui/animations-reanimated, a Popover.Content with an enterStyle does not animate on the first open of each popover. Its opacity goes from the enterStyle value straight to the final value in one frame. Every later open of the same popover animates normally.
It is per instance: opening and closing popover A, then opening popover B for the first time, still skips B's enter. With a 300ms timing transition the whole 300ms fade is skipped, so this is not a fast spring settling between samples.
Expected Behavior
The first open animates the same way later opens do, as it did in 1.x.
Tamagui Version
2.7.7 (@tamagui/popover, @tamagui/popper, @tamagui/animations-reanimated 2.7.7; react-native-reanimated 4.2.1, react-native-worklets 0.7.2).
Platform (Web, iOS, Android)
Web (react-native-web 0.21.2).
Reproduction
No styles of our own, only the animations from our config ('300ms' is { type: 'timing', duration: 300 }, quick is { type: 'spring', damping: 20, mass: 0.3 }):
import { Popover, View } from 'tamagui'
export const CleanPopover = ({ transition }: { transition: 'quick' | '300ms' }) => (
<Popover>
<Popover.Trigger asChild>
<button>open</button>
</Popover.Trigger>
<Popover.Content
testID="content"
transition={transition}
enterStyle={{ opacity: 0 }}
exitStyle={{ opacity: 0 }}
>
<View width={200} height={100} backgroundColor="red" />
</Popover.Content>
</Popover>
)Inline opacity of the content on each animation frame after the trigger click, on a fresh page load (each row repeated on two loads with the same result):
| First open | Second open | |
|---|---|---|
2.7.7, 300ms |
0 1 1 1 1 1 1 1 1 1 1 1 1 1 |
0 0 -0.0 0.13 0.28 0.41 0.53 0.62 0.71 0.77 0.82 0.86 0.90 |
2.7.7, quick |
0 1 1 1 1 1 1 1 |
0 0 0.72 0.21 0.66 0.96 1.08 |
1.144.4 (Moti driver), 300ms |
0.00 0.00 0.00 0.14 0.29 0.43 0.54 0.64 0.72 … |
0.00 0.00 0.00 0.07 0.22 0.37 0.49 0.60 … |
What the first open does differently
PopperContent hides its wrapper until floating-ui has a position:
const hide = !hasBeenPositioned.current && effectiveX === 0 && effectiveY === 0
// … wrapper gets opacity: hide ? 0 : 1, and no x/yThe last good position lives in the popper context, which outlives the content, so from the second open on the content is positioned and visible from its first render. On the first open, a mutation trace of the content and its wrapper shows:
53ms content opacity 0, wrapper opacity 0 at 0,0 (not yet positioned)
60ms content opacity 0, wrapper opacity 1 at 576,75 (floating-ui placed it)
63ms content opacity 1 (enter written as its final value)versus the second open, where the wrapper is placed and visible from the first frame and the content steps 0 → 0.10 → 0.26 → 0.39 …
So the enter starts while the popper still hides and has not placed the content, and by the time the wrapper shows, the driver has written the final value instead of animating to it. The first open also carries one extra render (the one that adds transformOrigin once floating-ui resolves), which lands before the first painted frame.
We could not reproduce the skip outside Popover. A plain View inside AnimatePresence animated its enter correctly when we added a style key mid-enter, before or after the first frame, when its mount ran inside a 60ms long task, and when it mounted inside a fresh Portal. So the exact driver path that turns this into a direct write is not pinned down; the trigger is specific to the popper's first positioning.
Workaround
We hold the content at its hidden values until the popper reports a non-zero x/y (read from usePopperContext()) and one frame has painted, then flip opacity/y props so the change animates as an ordinary prop change, instead of relying on enterStyle.
System Info
- macOS 26.5, Apple M1
- Node 26.4.0, bun 1.2.23
tamagui/@tamagui/core/@tamagui/popover/@tamagui/popper/@tamagui/animations-reanimated2.7.7react-native-reanimated4.2.1,react-native-worklets0.7.2react19.2.0,react-native-web0.21.2- Vite (Storybook 10)
Source: tamagui/tamagui