Skip to content
TypeScript

fix(mobile): let sheet lists scroll before dismissal (#17177)

Alex4bd0ecca1993
diff --git a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
index b0e25c6dcdb..7987e8ff6d6 100644
--- a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
+++ b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
@@ -54,15 +54,15 @@ function ConfiguredConnectOnboardingRouteScreen() {
cloudEnvironments: null,
});
- // Pull-to-refresh tracks its own spinner instead of discovery's refreshing
- // flag, so background refreshes (e.g. the sign-in one) don't yank the
- // content down.
- const [isPullRefreshing, setIsPullRefreshing] = useState(false);
- const handlePullRefresh = useCallback(() => {
+ const [isRefreshing, setIsRefreshing] = useState(false);
+ const handleRefresh = useCallback(() => {
void (async () => {
- setIsPullRefreshing(true);
- await refreshRelayEnvironments();
- setIsPullRefreshing(false);
+ setIsRefreshing(true);
+ try {
+ await refreshRelayEnvironments();
+ } finally {
+ setIsRefreshing(false);
+ }
})();
}, [refreshRelayEnvironments]);
@@ -87,7 +87,16 @@ function ConfiguredConnectOnboardingRouteScreen() {
{Platform.OS === "android" ? (
<AndroidSheetHeader
title="Set up T3 Connect"
- actions={[{ accessibilityLabel: "Close", icon: "xmark", onPress: handleClose }]}
+ actions={[
+ {
+ accessibilityLabel: "Refresh environments",
+ disabled: isRefreshing,
+ icon: "arrow.clockwise",
+ loading: isRefreshing,
+ onPress: handleRefresh,
+ },
+ { accessibilityLabel: "Close", icon: "xmark", onPress: handleClose },
+ ]}
/>
) : (
<NativeHeaderToolbar placement="right">
@@ -95,6 +104,7 @@ function ConfiguredConnectOnboardingRouteScreen() {
</NativeHeaderToolbar>
)}
<ScrollView
+ nestedScrollEnabled
alwaysBounceVertical
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
@@ -106,7 +116,9 @@ function ConfiguredConnectOnboardingRouteScreen() {
paddingTop: 16,
}}
refreshControl={
- <RefreshControl refreshing={isPullRefreshing} onRefresh={handlePullRefresh} />
+ Platform.OS === "ios" ? (
+ <RefreshControl refreshing={isRefreshing} onRefresh={handleRefresh} />
+ ) : undefined
}
>
{isSignedIn ? (
diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
index 81d48a94848..89580939d4c 100644
--- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
@@ -212,6 +212,7 @@ export function ConnectionsNewRouteScreen({
]}
>
<ScrollView
+ nestedScrollEnabled
contentInsetAdjustmentBehavior="automatic"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
diff --git a/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx b/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
index 72437e9baac..58a8931b84e 100644
--- a/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
@@ -56,6 +56,7 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
const content = (
<ScrollView
+ nestedScrollEnabled
className="flex-1"
// The iOS header is translucent and floats over this view; UIKit has to
// inset the content or the first row sits underneath the title.
diff --git a/apps/mobile/src/features/threads/ThreadQueueControl.tsx b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
index ff159ce82a9..19191e2fe83 100644
--- a/apps/mobile/src/features/threads/ThreadQueueControl.tsx
+++ b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
@@ -179,6 +179,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
queuedRuns.map(({ run }) => ({ id: run.id, ...rowLayouts.current.get(run.id) }));
const content = (
<ScrollView
+ nestedScrollEnabled
className="flex-1"
scrollEnabled={draggedRunId === null}
// The iOS header is translucent and floats over this view; UIKit has to
diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
index 13d1c37f0fc..1216608244e 100644
--- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
@@ -84,6 +84,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
) : null}
<MaterialScreenContent fitToContents>
<ScrollView
+ nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
index 59e2a0a1c5a..d1dfa0021ac 100644
--- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
@@ -103,6 +103,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
) : null}
<MaterialScreenContent fitToContents>
<ScrollView
+ nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
diff --git a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
index 3c695fef861..b9a509b435c 100644
--- a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
@@ -141,6 +141,7 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {
<MaterialScreenContent fitToContents>
<ScrollView
+ nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
showsVerticalScrollIndicator={false}
contentContainerClassName="android:gap-2 android:p-2"
diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
index 1741c527d91..094e385e6ab 100644
--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
@@ -252,21 +252,22 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
const behindCount = gitStatus.data?.behindCount ?? 0;
- // Deterministic pull-to-refresh state. Tying RefreshControl to the query's
+ // Deterministic refresh state. Tying RefreshControl to the query's
// isPending flag left the spinner stuck (the status query reports pending
// during quiet background refreshes too).
- const [isPullRefreshing, setIsPullRefreshing] = useState(false);
- const handlePullRefresh = useCallback(async () => {
- setIsPullRefreshing(true);
+ const [isRefreshing, setIsRefreshing] = useState(false);
+ const handleRefresh = useCallback(async () => {
+ setIsRefreshing(true);
try {
await gitActions.refreshSelectedThreadGitStatus();
} finally {
- setIsPullRefreshing(false);
+ setIsRefreshing(false);
}
}, [gitActions]);
const content = (
<ScrollView
+ nestedScrollEnabled
alwaysBounceVertical
className="flex-1 android:bg-sheet-solid ios:bg-screen"
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
@@ -278,7 +279,9 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
gap: Platform.OS === "android" ? 8 : 14,
}}
refreshControl={
- <RefreshControl refreshing={isPullRefreshing} onRefresh={() => void handlePullRefresh()} />
+ Platform.OS === "ios" || isInspector ? (
+ <RefreshControl refreshing={isRefreshing} onRefresh={() => void handleRefresh()} />
+ ) : undefined
}
>
<View
@@ -474,11 +477,11 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
{
id: "refresh",
title: "Refresh repository status",
- attributes: { disabled: busy || isPullRefreshing },
+ attributes: { disabled: busy || isRefreshing },
},
]}
onPressAction={({ nativeEvent }) => {
- if (nativeEvent.event === "refresh") void handlePullRefresh();
+ if (nativeEvent.event === "refresh") void handleRefresh();
}}
>
{(open) => (