@devries-cameron20 / t3code-1 / commits / fd64128014
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): iOS web previews keep their flick momentum (#27671)

Julius Marminge committed Nov 11, 2026 at 16:43 UTC fd64128014f2513a5d3d7ccbdf71febb74423e86
6 files changed +14
apps/mobile/src/components/PdfPreview.tsx
+2
@@ -3,6 +3,7 @@ import { View } from "react-native";
3 import { WebView } from "react-native-webview";
4
5 import { FilePreviewLoading, FilePreviewNotice } from "../features/files/FilePreviewFeedback";
6 +import { webViewDecelerationRate } from "../lib/webViewDecelerationRate";
7
8 export function PdfPreview(props: { readonly uri: string }) {
9 const [error, setError] = useState<string | null>(null);
@@ -13,6 +14,7 @@ export function PdfPreview(props: { readonly uri: string }) {
14 source={{ uri: props.uri }}
15 originWhitelist={["*"]}
16 automaticallyAdjustContentInsets={false}
17 + decelerationRate={webViewDecelerationRate}
18 contentInsetAdjustmentBehavior="never"
19 startInLoadingState
20 onError={(event) =>
apps/mobile/src/features/files/WorkspaceFileWebPreview.tsx
+2
@@ -11,6 +11,7 @@ import { PdfPreview } from "../../components/PdfPreview";
11 import { ControlPill } from "../../components/ui/ControlPill";
12 import { useHardwareBack } from "../../lib/backHandler";
13 import { isPdfPreviewUri } from "../../lib/pdfPreview";
14 +import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate";
15 import { useContentTopInset } from "../../components/ui/useBarInset";
16
17 export function WorkspaceFileWebPreview(props: { readonly uri: string | null }) {
@@ -58,6 +59,7 @@ function DocumentWebPreview(props: { readonly uri: string }) {
59 source={{ uri: props.uri }}
60 // react-native-webview defaults to "never", which starts the page under the header.
61 contentInsetAdjustmentBehavior="automatic"
62 + decelerationRate={webViewDecelerationRate}
63 originWhitelist={["*"]}
64 allowsBackForwardNavigationGestures
65 allowsFullscreenVideo
apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
+2
@@ -10,6 +10,7 @@ import { AppText as Text } from "../../../components/ui/AppText";
10 import { LoadingStrip } from "../../../components/ui/LoadingStrip";
11 import { SymbolView } from "../../../components/ui/AppSymbol";
12 import { isLegalDocumentUrl, LEGAL_URL } from "../lib/legal-document-url";
13 +import { webViewDecelerationRate } from "../../../lib/webViewDecelerationRate";
14
15 interface SettingsLegalDocumentRouteScreenProps {
16 readonly documentName: string;
@@ -100,6 +101,7 @@ export function SettingsLegalDocumentRouteScreen({
101 cacheEnabled={false}
102 cacheMode="LOAD_NO_CACHE"
103 allowsBackForwardNavigationGestures
104 + decelerationRate={webViewDecelerationRate}
105 domStorageEnabled={false}
106 incognito
107 javaScriptEnabled={false}
apps/mobile/src/features/threads/HtmlRenderWebView.tsx
+2
@@ -19,6 +19,7 @@ import { mobileHtmlRenderTheme } from "../../lib/htmlRenderTheme";
19 import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
20 import { useAssetUrlState, useRefreshAssetUrl } from "../../state/assets";
21 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
22 +import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate";
23
24 const ROW_BOTTOM_MARGIN = 8;
25 const FULL_SCREEN_GUTTER = 16;
@@ -130,6 +131,7 @@ export function HtmlRenderWebView(props: {
131 showsVerticalScrollIndicator={!props.nested}
132 showsHorizontalScrollIndicator={!props.nested}
133 scrollEnabled={scrollable}
134 + decelerationRate={webViewDecelerationRate}
135 // Android's patched WebView always keeps horizontal drags. Only pages
136 // with vertical overflow hold vertical drags until they reach an edge.
137 nestedScrollEnabled={props.nested && overflow.y}
apps/mobile/src/features/threads/McpAppWebView.tsx
+2
@@ -34,6 +34,7 @@ import { shareGeneratedAttachment } from "../../lib/attachmentDownload";
34 import { mobileHtmlRenderTheme } from "../../lib/htmlRenderTheme";
35 import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
36 import { uuidv4 } from "../../lib/uuid";
37 +import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate";
38 import { useAssetUrlState } from "../../state/assets";
39 import { appAtomRegistry } from "../../state/atom-registry";
40 import { useThreadShell } from "../../state/entities";
@@ -536,6 +537,7 @@ export function ThreadMcpApp(props: {
537 accessibilityLabel={`${app.server} app`}
538 style={{ flex: 1, backgroundColor: "transparent" }}
539 nestedScrollEnabled
540 + decelerationRate={webViewDecelerationRate}
541 originWhitelist={["*"]}
542 // Android misreports nested frames as top-level; rely on iframe sandboxing there and gate navigation elsewhere.
543 onShouldStartLoadWithRequest={(request) =>
apps/mobile/src/lib/webViewDecelerationRate.ts new
+4
@@ -0,0 +1,4 @@
1 +import { Platform } from "react-native";
2 +
3 +// react-native-webview on Fabric leaves an unset rate at 0, which UIKit clamps to "fast"; Android crashes on the string.
4 +export const webViewDecelerationRate = Platform.OS === "ios" ? "normal" : undefined;