File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { View } from "react-native";
33import { WebView } from "react-native-webview" ;
44
55import { FilePreviewLoading , FilePreviewNotice } from "../features/files/FilePreviewFeedback" ;
6+ import { webViewDecelerationRate } from "../lib/webViewDecelerationRate" ;
67
78export function PdfPreview ( props : { readonly uri : string } ) {
89 const [ error , setError ] = useState < string | null > ( null ) ;
@@ -13,6 +14,7 @@ export function PdfPreview(props: { readonly uri: string }) {
1314 source = { { uri : props . uri } }
1415 originWhitelist = { [ "*" ] }
1516 automaticallyAdjustContentInsets = { false }
17+ decelerationRate = { webViewDecelerationRate }
1618 contentInsetAdjustmentBehavior = "never"
1719 startInLoadingState
1820 onError = { ( event ) =>
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { PdfPreview } from "../../components/PdfPreview";
1111import { ControlPill } from "../../components/ui/ControlPill" ;
1212import { useHardwareBack } from "../../lib/backHandler" ;
1313import { isPdfPreviewUri } from "../../lib/pdfPreview" ;
14+ import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate" ;
1415import { useContentTopInset } from "../../components/ui/useBarInset" ;
1516
1617export function WorkspaceFileWebPreview ( props : { readonly uri : string | null } ) {
@@ -58,6 +59,7 @@ function DocumentWebPreview(props: { readonly uri: string }) {
5859 source = { { uri : props . uri } }
5960 // react-native-webview defaults to "never", which starts the page under the header.
6061 contentInsetAdjustmentBehavior = "automatic"
62+ decelerationRate = { webViewDecelerationRate }
6163 originWhitelist = { [ "*" ] }
6264 allowsBackForwardNavigationGestures
6365 allowsFullscreenVideo
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { AppText as Text } from "../../../components/ui/AppText";
1010import { LoadingStrip } from "../../../components/ui/LoadingStrip" ;
1111import { SymbolView } from "../../../components/ui/AppSymbol" ;
1212import { isLegalDocumentUrl , LEGAL_URL } from "../lib/legal-document-url" ;
13+ import { webViewDecelerationRate } from "../../../lib/webViewDecelerationRate" ;
1314
1415interface SettingsLegalDocumentRouteScreenProps {
1516 readonly documentName : string ;
@@ -100,6 +101,7 @@ export function SettingsLegalDocumentRouteScreen({
100101 cacheEnabled = { false }
101102 cacheMode = "LOAD_NO_CACHE"
102103 allowsBackForwardNavigationGestures
104+ decelerationRate = { webViewDecelerationRate }
103105 domStorageEnabled = { false }
104106 incognito
105107 javaScriptEnabled = { false }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { mobileHtmlRenderTheme } from "../../lib/htmlRenderTheme";
1919import { tryOpenExternalUrl } from "../../lib/openExternalUrl" ;
2020import { useAssetUrlState , useRefreshAssetUrl } from "../../state/assets" ;
2121import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider" ;
22+ import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate" ;
2223
2324const ROW_BOTTOM_MARGIN = 8 ;
2425const FULL_SCREEN_GUTTER = 16 ;
@@ -130,6 +131,7 @@ export function HtmlRenderWebView(props: {
130131 showsVerticalScrollIndicator = { ! props . nested }
131132 showsHorizontalScrollIndicator = { ! props . nested }
132133 scrollEnabled = { scrollable }
134+ decelerationRate = { webViewDecelerationRate }
133135 // Android's patched WebView always keeps horizontal drags. Only pages
134136 // with vertical overflow hold vertical drags until they reach an edge.
135137 nestedScrollEnabled = { props . nested && overflow . y }
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import { shareGeneratedAttachment } from "../../lib/attachmentDownload";
3434import { mobileHtmlRenderTheme } from "../../lib/htmlRenderTheme" ;
3535import { tryOpenExternalUrl } from "../../lib/openExternalUrl" ;
3636import { uuidv4 } from "../../lib/uuid" ;
37+ import { webViewDecelerationRate } from "../../lib/webViewDecelerationRate" ;
3738import { useAssetUrlState } from "../../state/assets" ;
3839import { appAtomRegistry } from "../../state/atom-registry" ;
3940import { useThreadShell } from "../../state/entities" ;
@@ -536,6 +537,7 @@ export function ThreadMcpApp(props: {
536537 accessibilityLabel = { `${ app . server } app` }
537538 style = { { flex : 1 , backgroundColor : "transparent" } }
538539 nestedScrollEnabled
540+ decelerationRate = { webViewDecelerationRate }
539541 originWhitelist = { [ "*" ] }
540542 // Android misreports nested frames as top-level; rely on iframe sandboxing there and gate navigation elsewhere.
541543 onShouldStartLoadWithRequest = { ( request ) =>
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments