Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(swipe-back): gesture rtl setting is reactive #26795

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/src/utils/gesture/swipe-back.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const createSwipeBackGesture = (
onEndHandler: (shouldComplete: boolean, step: number, dur: number) => void
): Gesture => {
const win = el.ownerDocument!.defaultView!;
const rtl = isRTL(el);
let rtl = isRTL(el);

/**
* Determine if a gesture is near the edge
Expand All @@ -39,6 +39,13 @@ export const createSwipeBackGesture = (
};

const canStart = (detail: GestureDetail) => {
/**
* The user's locale can change mid-session,
* so we need to check text direction at
* the beginning of every gesture.
*/
rtl = isRTL(el);

return isAtEdge(detail) && canStartHandler();
};

Expand Down