Repository navigation
Commit 1a93daa
committed
`testOnly_pressed` forces a Pressable's pressed state (for
snapshots/tests), but both v3 engines only seeded it into the initial
`useState(testOnly_pressed ?? false)`. After mount, changing the prop no
longer updated the functional `style`/`children`, so they showed a stale
pressed state.
Both engines now derive the displayed state from `testOnly_pressed ??
<pressed>` at the style/children call sites — a prop change is
reflected, while interactive presses still work when the prop is unset.
This matches RN's Pressable, which runs the style/children functions
with the forced pressed state on every render.
Follow-up to #4411. CodeRabbit flagged the stateful engine; the
Touchable-based engine had the identical issue.
Existing v3 suite passes (`yarn test` in
`packages/react-native-gesture-handler`). The change only affects the
value passed to functional `style`/`children` when `testOnly_pressed` is
set.
1 parent d4fe079 commit 1a93daa
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
375 | 380 | | |
376 | | - | |
| 381 | + | |
377 | 382 | | |
378 | 383 | | |
379 | 384 | | |
380 | | - | |
| 385 | + | |
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
| |||
0 commit comments