Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): include inherited offset in drawer close threshold
DavidShenc75d79871c1d
diff --git a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsxindex 983a6a1254..68af2e8698 100644--- a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx+++ b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx@@ -165,6 +165,29 @@ describe('shared Home drawer host', () => {native.gesture.end!({ translationX: -160, velocityX: 0 });expect(props.onClose).toHaveBeenCalledOnce();});+ it.each([+ { translationX: -40, velocityX: 0, closes: true },+ { translationX: -20, velocityX: 0, closes: false },+ { translationX: -20, velocityX: -900, closes: true },+ ])('uses the inherited rebound position when releasing a second swipe ($translationX, $velocityX)', async ({ translationX, velocityX, closes }) => {+ native.reduceMotion = false;+ await act(async () => root.render(<SessionListDrawer {...props} />));+ const [progress, dragX] = native.values;+ native.gesture.start!();+ native.gesture.update!({ translationX: -100 });+ native.gesture.end!({ translationX: -100, velocityX: 0 });+ expect(props.onClose).not.toHaveBeenCalled();+ // The first 100-point swipe is rebounding and still leaves 80 points hidden.+ progress!.value = 0.75;+ native.gesture.start!();+ native.gesture.update!({ translationX });+ native.gesture.end!({ translationX, velocityX });+ expect(props.onClose).toHaveBeenCalledTimes(closes ? 1 : 0);+ if (!closes) {+ expect(progress!.value).toBe(1);+ expect(dragX!.value).toBe(0);+ }+ });it('unmounts the invisible blocker even when the animation never calls completion', async () => {native.reduceMotion = false;await act(async () => root.render(<SessionListDrawer {...props} />));diff --git a/apps/mobile/src/session/SessionListDrawer.tsx b/apps/mobile/src/session/SessionListDrawer.tsxindex 17735497ff..25efdeaec5 100644--- a/apps/mobile/src/session/SessionListDrawer.tsx+++ b/apps/mobile/src/session/SessionListDrawer.tsx@@ -153,8 +153,10 @@ export function SessionListDrawer({ currentSessionId, persistent = false, newSes}).onEnd((event) => {'worklet';+ // Include the position inherited when a previous rebound was interrupted.+ const offsetX = (progress.value - 1) * panelWidth + Math.min(0, event.translationX);const shouldClose =- event.translationX < -panelWidth * DRAWER_CLOSE_DISTANCE_RATIO ||+ offsetX < -panelWidth * DRAWER_CLOSE_DISTANCE_RATIO ||event.velocityX < DRAWER_CLOSE_VELOCITY;if (shouldClose) {runOnJS(closeFromGesture)();