Skip to content

fix: recover gesture after display toggle regression (#885)#898

Closed
dohooo wants to merge 1 commit into
mainfrom
caspian/fix-issue-885-display-toggle-gesture
Closed

fix: recover gesture after display toggle regression (#885)#898
dohooo wants to merge 1 commit into
mainfrom
caspian/fix-issue-885-display-toggle-gesture

Conversation

@dohooo

@dohooo dohooo commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • stabilize e2e/11-display-toggle-regression.yaml by using retry-based swipe blocks (repeat + while notVisible) and explicit focus taps on e2e-carousel
  • add a fast regression unit test in src/components/Carousel.test.tsx:
    • display toggle regression #885: should keep swipe working after hide/show layout cycle
    • verifies both behavior (0 -> 1 -> 2) and that Pan gesture instance is recreated after onLayout transitions from zero to positive size
  • implement a minimal fix in src/components/ScrollViewGesture.tsx:
    • track hidden layout state (layoutWasHidden)
    • when onLayout detects 0 -> >0, schedule a gestureEpoch bump on RN thread
    • include gestureEpoch in the pan-config callback dependency path to force pan gesture recreation

Why

When parent display toggles (none -> flex), the existing GestureDetector binding can remain stale. Recreating the Pan gesture instance on the first recovered non-zero layout restores swipe responsiveness without API changes.

Validation

Red before fix

  • yarn test src/components/Carousel.test.tsx --runInBand -t "display toggle regression #885"
  • failed before patch with:
    • expected pan creation count > 1
    • received 1

Green after fix

  • yarn test src/components/Carousel.test.tsx --runInBand -t "display toggle regression #885"
  • yarn test src/components/Carousel.test.tsx --runInBand -t "Carousel sizing and measurement"
  • yarn biome check src/components/ScrollViewGesture.tsx src/components/Carousel.test.tsx e2e/11-display-toggle-regression.yaml

E2E

  • attempted:
    • APP_ID=com.react-native-reanimated-carousel.example maestro test e2e/11-display-toggle-regression.yaml
  • could not execute in this environment due no connected device (0 devices connected).

Closes #885.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 2, 2026
@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-reanimated-carousel Building Building Preview, Comment Mar 2, 2026 8:54am

Request Review

@changeset-bot

changeset-bot Bot commented Mar 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9ffe5a0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot

dosubot Bot commented Mar 2, 2026

Copy link
Copy Markdown

Related Documentation

Checked 4 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@dosubot dosubot Bot added the bug Something isn't working label Mar 2, 2026
@codecov

codecov Bot commented Mar 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.47%. Comparing base (5289d9d) to head (9ffe5a0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #898      +/-   ##
==========================================
+ Coverage   84.06%   84.47%   +0.40%     
==========================================
  Files          37       37              
  Lines        1042     1050       +8     
  Branches      364      366       +2     
==========================================
+ Hits          876      887      +11     
  Misses         67       67              
+ Partials       99       96       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dohooo dohooo closed this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Carousel gestures permanently stop working after parent view toggles display: 'none'

1 participant