Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): enable nested scrolling in Android action sheet

DavidShen0aafdd92efb8
diff --git a/apps/mobile/src/__tests__/sessionActionSheetAndroid.test.tsx b/apps/mobile/src/__tests__/sessionActionSheetAndroid.test.tsx
index 04df54f00f..9909c3f77d 100644
--- a/apps/mobile/src/__tests__/sessionActionSheetAndroid.test.tsx
+++ b/apps/mobile/src/__tests__/sessionActionSheetAndroid.test.tsx
@@ -25,7 +25,9 @@ vi.mock("@expo/ui/jetpack-compose", () => ({
},
}));
vi.mock("react-native", () => ({
- ScrollView: ({ children }: any) => <div>{children}</div>,
+ ScrollView: ({ children, nestedScrollEnabled }: any) => (
+ <div data-nested-scroll={nestedScrollEnabled ? "true" : "false"}>{children}</div>
+ ),
StyleSheet: { create: (s: any) => s },
useWindowDimensions: () => ({ width: 400, height: 800 }),
}));
@@ -151,6 +153,7 @@ describe.each([SessionActionSheetFrame, NativeBottomSheet])(
await act(async () => {
finish();
});
+
flushFrames();
expect(closed).toHaveBeenCalledOnce();
expect(container.textContent).toBe("");
@@ -208,3 +211,14 @@ describe.each([SessionActionSheetFrame, NativeBottomSheet])(
);
},
);
+
+it("enables nested scrolling for the native action-sheet content", () => {
+ act(() =>
+ root.render(
+ <SessionActionSheetFrame visible onClose={vi.fn()}>
+ actions
+ </SessionActionSheetFrame>,
+ ),
+ );
+ expect(container.querySelector('[data-nested-scroll="true"]')).not.toBeNull();
+});
diff --git a/apps/mobile/src/session/SessionActionSheetFrame.android.tsx b/apps/mobile/src/session/SessionActionSheetFrame.android.tsx
index 47adc7ef5e..f33fc21f4d 100644
--- a/apps/mobile/src/session/SessionActionSheetFrame.android.tsx
+++ b/apps/mobile/src/session/SessionActionSheetFrame.android.tsx
@@ -84,6 +84,10 @@ export function SessionActionSheetFrame({
<RNHostView matchContents>
<GestureHandlerRootView style={{ maxHeight: height * 0.8 }}>
<ScrollView
+ // Task tags and other expanded controls may host their own
+ // vertical lists. Let Android negotiate the child scroll first
+ // instead of locking gestures to the sheet viewport.
+ nestedScrollEnabled
keyboardShouldPersistTaps="handled"
contentContainerStyle={styles.content}
testID="home.sessionActions"
diff --git a/apps/mobile/src/session/TaskTags.tsx b/apps/mobile/src/session/TaskTags.tsx
index c215426c12..0a000971a0 100644
--- a/apps/mobile/src/session/TaskTags.tsx
+++ b/apps/mobile/src/session/TaskTags.tsx
@@ -937,6 +937,10 @@ export function TaskTagsPanel({
<View ref={viewportRef} collapsable={false}>
<ScrollView
ref={listRef}
+ // This list is rendered inside the Android native action-sheet
+ // ScrollView; opt into Android's nested-scroll contract on both
+ // sides so tag scrolling remains usable at either edge.
+ nestedScrollEnabled
scrollEnabled={!draggedId}
scrollEventThrottle={16}
onScroll={(event) => {