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

resolves #26794
This commit is contained in:
Liam DeBeasi
2023-02-16 14:41:09 -05:00
committed by GitHub
parent eaf088c3a2
commit 3a64de49db

View File

@@ -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
@@ -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();
};