Skip to content

fix(react-ui-core): clamp swipe-back dx to prevent left-drag screen movement#685

Merged
ENvironmentSet merged 2 commits intomainfrom
swipe-back-direction-lock
Mar 13, 2026
Merged

fix(react-ui-core): clamp swipe-back dx to prevent left-drag screen movement#685
ENvironmentSet merged 2 commits intomainfrom
swipe-back-direction-lock

Conversation

@ENvironmentSet
Copy link
Collaborator

@ENvironmentSet ENvironmentSet commented Mar 13, 2026

Summary

  • Fixed a bug in the Cupertino theme swipe-back gesture where dragging left from the edge caused the screen to translate in the negative direction
  • Added Math.max(0, ...) clamping to dx in onTouchMove so only rightward drags move the screen
  • Left swipes are now fully ignored, matching native iOS behavior

Closes FEP-1995

Test plan

  • In a Cupertino theme app, touch the left edge and drag left → screen stays fixed
  • Drag right → swipe-back works as expected
  • yarn test passes

🤖 Generated with Claude Code

…ovement

When a user starts a touch on the left edge and drags left, dx becomes
negative and moveActivity was translating the screen to the left.
Clamping dx to Math.max(0, ...) ensures only right swipes move the screen,
matching native iOS behavior.

Closes FEP-1995
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
stackflow-docs 25690c3 Commit Preview URL Mar 13 2026, 07:38 AM

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: 25690c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stackflow/react-ui-core Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50414730-32d1-4acd-8320-ea5e6964ef29

📥 Commits

Reviewing files that changed from the base of the PR and between 4d3b294 and 25690c3.

📒 Files selected for processing (2)
  • .changeset/fix-swipe-back-direction-lock.md
  • extensions/react-ui-core/src/useStyleEffectSwipeBack.ts

Disabled knowledge base sources:

  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

Bug Fixes

  • Fixed swipe-back gesture behavior to prevent unintended left-drag screen movement during touch-based navigation. The fix improves the reliability and consistency of back navigation by ensuring smooth operation without unwanted horizontal displacement, providing a more predictable and responsive gesture-based navigation experience across various mobile devices.

Walkthrough

A patch release for @stackflow/react-ui-core that fixes a bug in the swipe-back gesture handler by clamping horizontal swipe distance calculations to non-negative values using Math.max(0, x - x0), preventing unintended left-drag screen movements.

Changes

Cohort / File(s) Summary
Release metadata
.changeset/fix-swipe-back-direction-lock.md
Changeset documentation for patch version bump describing the swipe-back bug fix.
Swipe-back gesture fix
extensions/react-ui-core/src/useStyleEffectSwipeBack.ts
Constrained dx calculation in onTouchMove handler using Math.max(0, x - x0) to prevent negative swipe distances during back gestures.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swipe-back-direction-lock
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 13, 2026

Deploying stackflow-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 25690c3
Status: ✅  Deploy successful!
Preview URL: https://7e4555d3.stackflow-demo.pages.dev
Branch Preview URL: https://swipe-back-direction-lock.stackflow-demo.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 13, 2026

  • @stackflow/demo

    yarn add https://pkg.pr.new/@stackflow/react-ui-core@685.tgz
    

commit: 38a4abf

@ENvironmentSet ENvironmentSet merged commit b9c1946 into main Mar 13, 2026
6 of 8 checks passed
@ENvironmentSet ENvironmentSet deleted the swipe-back-direction-lock branch March 13, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants