Files
bsky-social-app/patches/react-native-drawer-layout@4.2.3.patch
T
Tomek Zawadzki 95ce988fb7 WIP
2026-09-07 11:16:05 +02:00

48 lines
1.7 KiB
Diff

diff --git a/lib/module/views/Drawer.native.js b/lib/module/views/Drawer.native.js
index 38470a658878a63919186257041098747ec55473..b9d25798c9be229efeb676166f89bfbc72615793 100644
--- a/lib/module/views/Drawer.native.js
+++ b/lib/module/views/Drawer.native.js
@@ -124,15 +124,21 @@ export function Drawer({
}
onTransitionEnd?.(!open);
});
+ const animatingTo = useSharedValue(null)
const toggleDrawer = React.useCallback((open, velocity) => {
'worklet';
+ if (animatingTo.value === (open ? 'open' : 'close')) {
+ return;
+ }
+
const translateX = getDrawerTranslationX(open);
if (velocity === undefined) {
runOnJS(onAnimationStart)(open);
}
touchStartX.value = 0;
touchX.value = 0;
+ animatingTo.value = open ? 'open' : 'close';
translationX.value = withSpring(translateX, {
velocity,
stiffness: 1000,
@@ -142,7 +148,10 @@ export function Drawer({
restDisplacementThreshold: 0.01,
restSpeedThreshold: 0.01,
reduceMotion: ReduceMotion.Never
- }, finished => runOnJS(onAnimationEnd)(open, finished));
+ }, finished => {
+ animatingTo.value = null;
+ runOnJS(onAnimationEnd)(open, finished);
+ });
if (open) {
runOnJS(onOpen)();
} else {
diff --git a/lib/typescript/src/types.d.ts b/lib/typescript/src/types.d.ts
--- a/lib/typescript/src/types.d.ts
+++ b/lib/typescript/src/types.d.ts
@@ -1,4 +1,4 @@
import * as React from 'react';
import type { StyleProp, View, ViewStyle } from 'react-native';
-import type { PanGesture } from 'react-native-gesture-handler';
+import type { LegacyPanGesture as PanGesture } from 'react-native-gesture-handler';
import type { SharedValue } from 'react-native-reanimated';