File tree Expand file tree Collapse file tree
packages/react-native-gesture-handler/src/v3/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -284,11 +284,18 @@ const PressableWithTouchable = (props: PressableProps) => {
284284 }
285285 : undefined ;
286286
287+ // `testOnly_pressed` forces the pressed state (for snapshots/tests) and can
288+ // change after mount, so derive the displayed state from it rather than the
289+ // mount-only `pressed`.
290+ const displayPressed = testOnly_pressed ?? pressed ;
291+
287292 const resolvedStyle =
288- typeof style === 'function' ? style ( { pressed } ) : style ;
293+ typeof style === 'function' ? style ( { pressed : displayPressed } ) : style ;
289294
290295 const resolvedChildren =
291- typeof children === 'function' ? children ( { pressed } ) : children ;
296+ typeof children === 'function'
297+ ? children ( { pressed : displayPressed } )
298+ : children ;
292299
293300 return (
294301 < Touchable
You can’t perform that action at this time.
0 commit comments