fix(mobile): let sheet lists scroll before dismissal (#17177)
This commit is contained in:
8 files changed
+39
-18
No files matched your search
@@ -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 ? (
|
||||
|
||||
@@ -212,6 +212,7 @@ export function ConnectionsNewRouteScreen({
|
||||
]}
|
||||
>
|
||||
<ScrollView
|
||||
nestedScrollEnabled
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) => (
|
||||
|
||||
Reference in new issue
Block a user